-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
145 lines (145 loc) · 4.93 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
<!DOCTYPE html>
<html lang="en-us">
<head>
<style>
@keyframes blinker { 50%{opacity:0;}} .blink-text {animation: blinker 1s step-start infinite; }
</style>
<meta charset="utf-8">
<title>RustSega</title>
<style>
body {
font-family: arial;
margin: 0;
padding: none;
background-color: black;
color: white;
}
.emscripten {
padding-right: 0;
margin-left: auto;
margin-right: auto;
display: block;
}
div.emscripten {
text-align: center;
}
div.emscripten_border {
border: 1px solid black;
}
/* the canvas *must not* have any border or padding, or mouse coords will be wrong */
canvas.emscripten {
border: 0px none;
background-color: black;
}
#controls {
display: inline-block;
float: right;
vertical-align: top;
margin-top: 30px;
margin-right: 20px;
}
#output {
width: 100%;
height: 300px;
margin: 0 auto;
margin-top: 10px;
border-left: 0px;
border-right: 0px;
padding-left: 0px;
padding-right: 0px;
display: block;
background-color: black;
color: white;
font-family: 'Lucida Console', Monaco, monospace;
outline: none;
}
.marquee {
line-height: 30px;
text-align:center
}
.marquee p {
display: inline-block;
animation: marquee 15s linear infinite;
}
@keyframes marquee {
0% { transform: translate(0, 0);}
100% { transform: translate(-100%, 0);}
}
#rust_logo {
height: 2em;
width: 2em;
vertical-align: middle;
object-fit: contain;
margin: 0 -0.3em 0; /* The icon has a 'large' area, so setting a negative margine. */
filter: invert(96%) sepia(54%) saturate(6594%) hue-rotate(356deg) brightness(105%) contrast(104%);*/ /* Somehow this is yellow */
}
</style>
<style>
div {} input:checked + div {mix-blend-mode: difference;animation: blinker 1s step-start infinite;}
</style>
<style>
#rom_drop { border: 5px dashed #ccc; margin: 10px auto;}
#rom_drop.hide_border { border: none;}
#rom_drop.highlight { border-color: purple; }
</style>
</head>
<body>
<span id="controls">
<span><!-- pointerLock, resize -->
<input type="button" value="Fullscreen" onclick="Module.requestFullscreen(false, false)"/>
</span>
</span>
<div class="emscripten_border" id="rom_drop" style=
"background-image: url('https://upload.wikimedia.org/wikipedia/commons/thumb/0/0b/Sega-Master-System-Set.png/640px-Sega-Master-System-Set.png');">
<h1 style="mix-blend-mode: difference;text-align:center;color:yellow">Sega <span class="blink-text">Maste<img alt="r" id="rust_logo" src="https://www.rust-lang.org/static/images/rust-logo-blk.svg"> System</span>!</h1>
<input type="checkbox" id="90s" name="90s" checked/>90s Style
<div>
<canvas width="0" height="0" class="emscripten" id="canvas"
oncontextmenu="event.preventDefault()"></canvas>
</div>
<div class="marquee">
<p>Drop Sega Master System Rom here to start emulation.</p>
</div>
<p style="mix-blend-mode: difference;">Refresh page to start again.</p>
</div>
<textarea id="output" rows="8"></textarea>
<div style="text-align:center;">
<img alt="An amazing animation depicting the evolution of mankind." src="https://upload.wikimedia.org/wikipedia/commons/1/1c/Under-Construction-Bulldozer.gif">
</div>
<script type="text/javascript">
var display_data;
var Module = {
arguments: ['""'], // Provide an 'empty' cartridge name (as it's a required argument).
onRuntimeInitialized: (function() {
display_data = Module.cwrap('display_data', 'void', ['array', 'number']);
}
),
print: (function() {
var element = document.getElementById('output')
if (element) element.value = '' // clear browser cache
return function(text) {
if (arguments.length > 1)
text = Array.prototype.slice.call(arguments).join(' ')
console.log(text)
if (element) {
element.value += text + '\n'
element.scrollTop = element.scrollHeight // focus on bottom
}
}
})(),
canvas: (function() {
return document.getElementById('canvas')
})(),
}
</script>
<script type="text/javascript" src="target/wasm32-unknown-emscripten/release/rustsega.js"
onerror="alert('Script not found: target/wasm32-unknown-emscripten/release/rustsega.js\nbuild with:\n(cd projects/emscripten && cargo build --release)')">
</script>
<script>
function handleNewFileData(data) {
display_data(data, data.length);
}
</script>
<script type="module" src="file_drop.js"></script>
</body>
</html>