forked from ThatFruedDued/okremu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mobileframe.html
109 lines (107 loc) · 4.4 KB
/
mobileframe.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="emustyle.css">
<title>okrEMU</title>
<!-- android -->
<meta name="mobile-web-app-capable" content="yes">
<!-- iOS -->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="translucent-black">
<meta name="apple-mobile-web-app-title" content="okrEMU">
<meta name="viewport" content="width=device-width,height=device-height,user-scalable=no,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0">
<link href="https://fonts.googleapis.com/css?family=Roboto&display=swap" rel="stylesheet">
<link rel='stylesheet' href='css/styledselect.css'>
<link rel='stylesheet' href='css/index-main.css'>
</head>
<body>
<div class="draghint hidden screen" id="draghint">
<input type="file" id="chooser" class="chooser" disabled/>
<div class="dragtext">
<h1>Launching...</h1>
</div>
</div>
<div id="loading" class="message screen"><h1>Loading...</h1></div>
<div id="error" class="message hidden screen">
<h1>Error</h1>
<div id="clear-save" class="hidden">
<p>This could be caused by a corrupted save file. This button
will allow you to reset your save. Sadly, you will not be able to
recover your save.</p>
<button onclick="removeSave(); reset()">Delete save for this game</button>
</div>
</div>
<div id="overlay" class="overlay"></div>
<div class="menu hidden screen" id="menu">
<input type="file" id="savechooser" class="chooser"/>
<div class="options">
<h1>Your game is paused.</h1>
<button onclick="resume()">resume</button>
<button onclick="reset()">reset</button>
<button onclick="save()">save game</button>
<button onclick="loadfunc()">load save</button>
<button onclick="removeSave(); reset()">delete save</button>
<button id="mute" onclick="mute()">mute</button>
</div>
<div>
<h1>Core Info:</h1>
<pre id="core-name"></pre>
<pre id="system-info"></pre>
<pre id="av-info"></pre>
</div>
</div>
<script src="scr1.js"></script>
<script src="scr2.js"></script>
<script src="scr3mobile.js"></script>
<script src="localForage/dist/localforage.js"></script>
<script>System.import('./index.coffee!')</script>
<script>
window.addEventListener('keydown', window.keydownlistener);
window.addEventListener('keyup', window.keyuplistener);
async function execution(id, ext){
var cachedVersion = await localforage.getItem(id);
if(cachedVersion == null || cachedVersion == undefined) {
var blob;
async function setBlobToUrl(url){blob = await fetch(url).then(r => r.blob());}
await setBlobToUrl('https://corsbyp.herokuapp.com/https://drive.google.com/uc?export=download&id=' + id);
load(new File([blob], 'game.' + ext));
} else {
load(new File([cachedVersion], 'game.' + ext));
}
}
var id = localStorage.getItem('gameid'),
extension = localStorage.getItem('gameext'),
dev = localStorage.getItem('devdata');
if(dev === 'launcher.jsnes'){
document.location.href = 'dev/jsnes/jsnes.html';
}
execution(id, extension);
function rebind(){
window.removeEventListener('keydown', window.keydownlistener);
window.removeEventListener('keyup', window.keyuplistener);
window.addEventListener('keydown', window.rebindlistener);
callingButton.innerHTML = "Press any key to rebind...";
for (var indexx = 0; indexx < document.getElementsByTagName('BUTTON').length; indexx++) {
document.getElementsByTagName('BUTTON')[indexx].disabled = true;
}
}
function rebindlistener(event){
window.addEventListener('keydown', keydownlistener);
window.addEventListener('keyup', keyuplistener);
window.removeEventListener('keydown', rebindlistener);
var keytext = event.key.toLowerCase();
if (keytext === ' ') {
keytext = 'space';
}
callingButton.innerHTML = keytext;
for (var indexx = 0; indexx < document.getElementsByTagName('BUTTON').length; indexx++) {
document.getElementsByTagName('BUTTON')[indexx].disabled = false;
}
localStorage.setItem(callingButton.id, event.key + '');
callingButton = null;
}
</script>
</body>
</html>