forked from EmulatorJS/EmulatorJS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
414 lines (360 loc) · 15.4 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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
<!DOCTYPE html>
<html>
<head>
<title>Not EmulatorJS</title>
<link rel="icon" href="docs/favicon.ico" sizes="16x16 32x32 48x48 64x64" type="image/vnd.microsoft.icon">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');
body, html {
height: 100vh;
background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
color: #ffffff;
margin: 0;
font-family: 'Inter', sans-serif;
display: flex;
flex-direction: column;
position: relative;
overflow-x: hidden;
width: 100vw;
}
body {
flex: 1;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
}
.main-content {
display: flex;
flex-direction: column;
align-items: center;
margin-top: 2rem;
}
#box, #top {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
}
#box {
color: #e0e0e0;
height: 20em;
width: 30em;
max-width: 80%;
max-height: 80%;
background: rgba(40, 40, 40, 0.95);
border-radius: 1rem;
border: none;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
position: relative;
transition: all 0.3s ease;
overflow: hidden;
font-weight: 600;
font-size: 1.25rem;
margin: 1rem;
backdrop-filter: blur(5px);
}
#box:hover, #box[drag] {
box-shadow: 0 6px 20px rgba(56, 128, 255, 0.3);
color: #ffffff;
transform: translateY(-2px);
}
#input {
cursor: pointer;
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
opacity: 0;
}
#display {
width: 100%;
height: 100vh; /* Full viewport height */
display: flex;
justify-content: center;
align-items: center;
overflow: hidden; /* Prevent scrollbars */
}
#game {
width: 100%;
height: 100%;
max-width: 100%;
max-height: 100vh; /* Ensure the game content doesn't exceed viewport height */
object-fit: contain; /* Scale the game content to fit within the container */
}
select, button {
padding: 0.75rem 1rem;
margin: 0.5rem;
width: 15em;
max-width: 100%;
font-family: 'Inter', sans-serif;
font-weight: 600;
font-size: 1rem;
background: rgba(60, 60, 60, 0.9);
color: #e0e0e0;
border-radius: 0.75rem;
border: none;
cursor: pointer;
transition: all 0.3s ease;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}
select:hover, button:hover {
background: rgba(90, 90, 90, 0.9);
color: #ffffff;
transform: translateY(-1px);
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}
.logo {
width: 130px;
height: 130px;
filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.3));
transition: transform 0.3s ease;
cursor: pointer;
}
.logo:hover {
transform: scale(1.05);
}
#top {
margin: 1rem;
}
h1 {
font-size: 3rem;
font-weight: 700;
background: linear-gradient(90deg, #ffffff, #a0a0a0);
-webkit-background-clip: text;
background-clip: text;
color: transparent;
text-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}
footer {
width: 100%;
padding: 0.7rem 1rem;
color: #e0e0e0;
font-style: italic;
font-size: 0.9rem;
font-weight: 400;
background: rgba(30, 30, 30, 0.8);
backdrop-filter: blur(5px);
box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
z-index: 5;
margin-top: auto;
display: flex;
justify-content: center;
align-items: center;
position: relative;
}
.github-button {
position: absolute;
right: 1.15rem;
bottom: 0.2rem;
display: flex;
justify-content: center;
align-items: center;
padding: 2px 6px;
gap: 4px;
background-color: #181717;
outline: 2px #181717 solid;
outline-offset: -2px;
border-radius: 5px;
border: none;
cursor: pointer;
transition: 400ms;
z-index: 10;
text-decoration: none;
font-style: normal;
}
.github-button .text {
color: white;
font-weight: 700;
font-size: 0.6em;
transition: 400ms;
}
.github-button svg {
width: 12px;
height: 12px;
}
.github-button svg path {
transition: 400ms;
}
.github-button:hover {
background-color: transparent;
}
.github-button:hover .text {
color: #181717;
}
.github-button:hover svg path {
fill: #181717;
}
.supported-systems-link {
color: #e0e0e0;
font-family: 'Inter', sans-serif;
font-weight: 600;
font-size: 1.25rem;
text-decoration: underline;
margin: 1rem 0;
transition: color 0.3s ease, transform 0.3s ease;
}
.supported-systems-link:hover {
color: #ffffff;
transform: translateY(-2px);
}
</style>
</head>
<body>
<div class="main-content">
<div id="top">
<h1>Not EmulatorJS</h1>
<a href="https://emulatorjs.org/" target="_blank">
<img src="docs/Logo-light.png" alt="Logo" class="logo">
</a>
</div>
<div id="box">
<input type="file" id="input">
Drag ROM file or Click Here
</div>
<a href="supported-systems.html" class="supported-systems-link">Supported Systems</a>
</div>
<footer>
<span class="footer-text">Not EmulatorJS: A lightweight, browser-based emulator using EmulatorJS.</span>
<a href="https://github.com/hackz00/NotEmulatorJS" class="github-button">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M12 0.296997C5.37 0.296997 0 5.67 0 12.297C0 17.6 3.438 22.097 8.205 23.682C8.805 23.795 9.025 23.424 9.025 23.105C9.025 22.82 9.015 22.065 9.01 21.065C5.672 21.789 4.968 19.455 4.968 19.455C4.422 18.07 3.633 17.7 3.633 17.7C2.546 16.956 3.717 16.971 3.717 16.971C4.922 17.055 5.555 18.207 5.555 18.207C6.625 20.042 8.364 19.512 9.05 19.205C9.158 18.429 9.467 17.9 9.81 17.6C7.145 17.3 4.344 16.268 4.344 11.67C4.344 10.36 4.809 9.29 5.579 8.45C5.444 8.147 5.039 6.927 5.684 5.274C5.684 5.274 6.689 4.952 8.984 6.504C9.944 6.237 10.964 6.105 11.984 6.099C13.004 6.105 14.024 6.237 14.984 6.504C17.264 4.952 18.269 5.274 18.269 5.274C18.914 6.927 18.509 8.147 18.389 8.45C19.154 9.29 19.619 10.36 19.619 11.67C19.619 16.28 16.814 17.295 14.144 17.59C14.564 17.95 14.954 18.686 14.954 19.81C14.954 21.416 14.939 22.706 14.939 23.096C14.939 23.411 15.149 23.786 15.764 23.666C20.565 22.092 24 17.592 24 12.297C24 5.67 18.627 0.296997 12 0.296997Z" fill="white"></path>
</svg>
<p class="text">Github</p>
</a>
</footer>
<script>
let enableDebug = false;
let enableThreads = false;
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
if (urlParams.get('debug') == 1) {
enableDebug = true;
console.log("Debug is enabled");
} else {
console.log("Debug is disabled");
}
if (urlParams.get('threads') == 1) {
if (window.SharedArrayBuffer) {
enableThreads = true;
console.log("Threads are enabled");
} else {
console.warn("Threads are disabled as SharedArrayBuffer is not available. Threads requires two headers to be set when sending you html page. See https://stackoverflow.com/a/68630724");
console.log("Threads are disabled");
}
} else {
console.log("Threads are disabled");
}
input.onchange = async () => {
const url = input.files[0];
const parts = input.files[0].name.split(".");
const core = await (async (ext) => {
if (["fds", "nes", "unif", "unf"].includes(ext))
return "nes";
if (["smc", "fig", "sfc", "gd3", "gd7", "dx2", "bsx", "swc"].includes(ext))
return "snes";
if (["z64", "n64"].includes(ext))
return "n64";
if (["pce"].includes(ext))
return "pce";
if (["ngp", "ngc"].includes(ext))
return "ngp";
if (["ws", "wsc"].includes(ext))
return "ws";
if (["col", "cv"].includes(ext))
return "coleco";
if (["d64"].includes(ext))
return "vice_x64sc";
if (["nds", "gba", "gb", "z64", "n64"].includes(ext))
return ext;
return await new Promise(resolve => {
var coreValues = {
"Nintendo 64": "n64",
"Nintendo Game Boy": "gb",
"Nintendo Game Boy Advance": "gba",
"Nintendo DS": "nds",
"Nintendo Entertainment System": "nes",
"Super Nintendo Entertainment System": "snes",
"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",
"Arcade": "arcade",
"NEC TurboGrafx-16/SuperGrafx/PC Engine": "pce",
"NEC PC-FX": "pcfx",
"SNK NeoGeo Pocket (Color)": "ngp",
"Bandai WonderSwan (Color)": "ws",
"ColecoVision": "coleco",
"Commodore 64": "vice_x64sc",
"Commodore 128": "vice_x128",
"Commodore VIC20": "vice_xvic",
"Commodore Plus/4": "vice_xplus4",
"Commodore PET": "vice_xpet"
};
const cores = Object.keys(coreValues).sort().reduce(
(obj, key) => {
obj[key] = coreValues[key];
return obj;
},
{}
);
const button = document.createElement("button");
const select = document.createElement("select");
for (const type in cores) {
const option = document.createElement("option");
option.value = cores[type];
option.textContent = type;
select.appendChild(option);
}
button.onclick = () => resolve(select[select.selectedIndex].value);
button.textContent = "Load game";
box.innerHTML = "";
box.appendChild(select);
box.appendChild(button);
});
})(parts.pop());
const div = document.createElement("div");
const sub = document.createElement("div");
const script = document.createElement("script");
sub.id = "game";
div.id = "display";
// Remove the entire .main-content div to clear all elements (title, logo, box, and Supported Systems link)
const mainContent = document.querySelector(".main-content");
mainContent.remove();
// Remove the entire footer (including the GitHub button)
const footer = document.querySelector("footer");
if (footer) {
footer.remove();
}
// Prevent body overflow to remove the scrollbar
document.body.style.overflow = "hidden";
div.appendChild(sub);
document.body.appendChild(div);
window.EJS_player = "#game";
window.EJS_gameName = parts.shift();
window.EJS_biosUrl = "";
window.EJS_gameUrl = url;
window.EJS_core = core;
window.EJS_pathtodata = "data/";
window.EJS_startOnLoaded = true;
window.EJS_DEBUG_XX = enableDebug;
window.EJS_disableDatabases = true;
window.EJS_threads = enableThreads;
script.src = "data/loader.js";
document.body.appendChild(script);
};
box.ondragover = () => box.setAttribute("drag", true);
box.ondragleave = () => box.removeAttribute("drag");
</script>
</body>
</html>