|
1 | 1 | <!DOCTYPE html>
|
2 | 2 | <html>
|
3 | 3 | <head>
|
4 |
| - <title>EmulatorJS Demo</title> |
5 |
| - <link rel = icon href = docs/favicon.ico sizes = "16x16 32x32 48x48 64x64" type = image/vnd.microsoft.icon> |
6 |
| - <meta name = viewport content = "width = device-width, initial-scale = 1"> |
7 | 4 | <style>
|
8 | 5 | body, html {
|
9 | 6 | height: 100%;
|
|
15 | 12 | margin: 0;
|
16 | 13 | overflow: hidden;
|
17 | 14 | }
|
18 |
| - |
19 |
| - body, #box, #top { |
20 |
| - display: flex; |
21 |
| - align-items: center; |
22 |
| - justify-content: center; |
23 |
| - flex-direction: column; |
24 |
| - } |
25 |
| - |
26 |
| - #box { |
27 |
| - color: #aaa; |
28 |
| - height: 20em; |
29 |
| - width: 30em; |
30 |
| - max-width: 80%; |
31 |
| - max-height: 80%; |
32 |
| - background-color: #333; |
33 |
| - border-radius: 0.4em; |
34 |
| - border: 2px solid #555; |
35 |
| - position: relative; |
36 |
| - flex-direction: column; |
37 |
| - transition-duration: 0.2s; |
38 |
| - overflow: hidden; |
39 |
| - font-family: monospace; |
40 |
| - font-weight: bold; |
41 |
| - font-size: 20px; |
42 |
| - margin: 5px; |
43 |
| - } |
44 |
| - |
45 |
| - #box:hover, #box[drag] { |
46 |
| - border-color: #38f; |
47 |
| - color: #ddd |
48 |
| - } |
49 |
| - |
50 |
| - #input { |
51 |
| - cursor: pointer; |
52 |
| - position: absolute; |
53 |
| - left: 0; |
54 |
| - top: 0; |
55 |
| - width: 100%; |
56 |
| - height: 100%; |
57 |
| - opacity: 0 |
58 |
| - } |
59 |
| - |
60 |
| - #display { |
61 |
| - width: 100%; |
62 |
| - height: 100% |
63 |
| - } |
64 |
| - |
65 |
| - select, button { |
66 |
| - padding: 0.6em 0.4em; |
67 |
| - margin: 0.5em; |
68 |
| - width: 15em; |
69 |
| - max-width: 100%; |
70 |
| - font-family: monospace; |
71 |
| - font-weight: bold; |
72 |
| - font-size: 16px; |
73 |
| - background-color: #444; |
74 |
| - color: #aaa; |
75 |
| - border-radius: 0.4em; |
76 |
| - border: 1px solid #555; |
77 |
| - cursor: pointer; |
78 |
| - transition-duration: 0.2s |
79 |
| - } |
80 |
| - |
81 |
| - select:hover, button:hover { |
82 |
| - background-color: #666; |
83 |
| - color: #ddd |
84 |
| - } |
85 |
| - |
86 |
| - .logo { |
87 |
| - width: 130px; |
88 |
| - height: 130px; |
89 |
| - filter: drop-shadow(0 0 10px white); |
90 |
| - } |
91 |
| - |
92 |
| - #top { |
93 |
| - margin: 5px; |
94 |
| - } |
95 |
| - </style> |
96 | 15 | </head>
|
97 |
| - |
98 | 16 | <body>
|
99 |
| - <div id="top"> |
100 |
| - <h1>EmulatorJS Demo</h1> |
101 |
| - <img src="docs/Logo-light.png" alt="Logo" class="logo"> |
| 17 | + <div style="width:100%;height:100%;max-width:100%"> |
| 18 | + <div id="game"></div> |
102 | 19 | </div>
|
103 |
| - <div id = box> |
104 |
| - <input type = file id = input> |
105 |
| - Drag ROM file or click here |
106 |
| - </div> |
107 |
| - |
108 | 20 | <script>
|
109 |
| - var enableDebug = false; |
110 |
| - const queryString = window.location.search; |
111 |
| - const urlParams = new URLSearchParams(queryString); |
112 |
| - if (urlParams.get('debug') == 1) |
113 |
| - enableDebug = true; |
114 |
| - |
115 |
| - if (enableDebug == true) { |
116 |
| - console.log("Debug is enabled"); |
117 |
| - } else { |
118 |
| - console.log("Debug is disabled"); |
119 |
| - } |
120 |
| - |
121 |
| - input.onchange = async () => { |
122 |
| - const url = new Blob([input.files[0]]) |
123 |
| - const parts = input.files[0].name.split(".") |
124 |
| - |
125 |
| - const core = await (async (ext) => { |
126 |
| - if (["fds", "nes", "unif", "unf"].includes(ext)) |
127 |
| - return "nes" |
128 |
| - |
129 |
| - if (["smc", "fig", "sfc", "gd3", "gd7", "dx2", "bsx", "swc"].includes(ext)) |
130 |
| - return "snes" |
131 |
| - |
132 |
| - if (["z64", "n64"].includes(ext)) |
133 |
| - return "n64" |
134 |
| - |
135 |
| - if (["pce"].includes(ext)) |
136 |
| - return "pce" |
137 |
| - |
138 |
| - if (["ngp", "ngc"].includes(ext)) |
139 |
| - return "ngp" |
140 |
| - |
141 |
| - if (["ws", "wsc"].includes(ext)) |
142 |
| - return "ws" |
143 |
| - |
144 |
| - if (["col", "cv"].includes(ext)) |
145 |
| - return "coleco" |
146 |
| - |
147 |
| - if (["d64"].includes(ext)) |
148 |
| - return "vice_x64sc" |
149 |
| - |
150 |
| - if (["nds", "gba", "gb", "z64", "n64"].includes(ext)) |
151 |
| - return ext |
152 |
| - |
153 |
| - return await new Promise(resolve => { |
154 |
| - var coreValues = { |
155 |
| - "Nintendo 64": "n64", |
156 |
| - "Nintendo Game Boy": "gb", |
157 |
| - "Nintendo Game Boy Advance": "gba", |
158 |
| - "Nintendo DS": "nds", |
159 |
| - "Nintendo Entertainment System": "nes", |
160 |
| - "Super Nintendo Entertainment System": "snes", |
161 |
| - "PlayStation": "psx", |
162 |
| - "Virtual Boy": "vb", |
163 |
| - "Sega Mega Drive": "segaMD", |
164 |
| - "Sega Master System": "segaMS", |
165 |
| - "Sega CD": "segaCD", |
166 |
| - "Atari Lynx": "lynx", |
167 |
| - "Sega 32X": "sega32x", |
168 |
| - "Atari Jaguar": "jaguar", |
169 |
| - "Sega Game Gear": "segaGG", |
170 |
| - "Sega Saturn": "segaSaturn", |
171 |
| - "Atari 7800": "atari7800", |
172 |
| - "Atari 2600": "atari2600", |
173 |
| - "NEC TurboGrafx-16/SuperGrafx/PC Engine": "pce", |
174 |
| - "NEC PC-FX": "pcfx", |
175 |
| - "SNK NeoGeo Pocket (Color)": "ngp", |
176 |
| - "Bandai WonderSwan (Color)": "ws", |
177 |
| - "ColecoVision": "coleco", |
178 |
| - "Commodore 64": "vice_x64sc", |
179 |
| - "Commodore 128": "vice_x128", |
180 |
| - "Commodore VIC20": "vice_xvic", |
181 |
| - "Commodore Plus/4": "vice_xplus4", |
182 |
| - "Commodore PET": "vice_xpet" |
183 |
| - } |
184 |
| - |
185 |
| - const cores = Object.keys(coreValues).sort().reduce( |
186 |
| - (obj, key) => { |
187 |
| - obj[key] = coreValues[key]; |
188 |
| - return obj; |
189 |
| - }, |
190 |
| - {} |
191 |
| - ); |
192 |
| - |
193 |
| - const button = document.createElement("button") |
194 |
| - const select = document.createElement("select") |
195 |
| - |
196 |
| - for (const type in cores) { |
197 |
| - const option = document.createElement("option") |
198 |
| - |
199 |
| - option.value = cores[type] |
200 |
| - option.textContent = type |
201 |
| - select.appendChild(option) |
202 |
| - } |
203 |
| - |
204 |
| - button.onclick = () => resolve(select[select.selectedIndex].value) |
205 |
| - button.textContent = "Load game" |
206 |
| - box.innerHTML = "" |
207 |
| - |
208 |
| - box.appendChild(select) |
209 |
| - box.appendChild(button) |
210 |
| - }) |
211 |
| - })(parts.pop()) |
212 |
| - |
213 |
| - const div = document.createElement("div") |
214 |
| - const sub = document.createElement("div") |
215 |
| - const script = document.createElement("script") |
216 |
| - |
217 |
| - sub.id = "game" |
218 |
| - div.id = "display" |
219 |
| - |
220 |
| - const top = document.getElementById("top"); |
221 |
| - top.remove(); |
222 |
| - box.remove() |
223 |
| - div.appendChild(sub) |
224 |
| - document.body.appendChild(div) |
225 |
| - |
226 |
| - window.EJS_player = "#game"; |
227 |
| - window.EJS_gameName = parts.shift(); |
228 |
| - window.EJS_biosUrl = ""; |
229 |
| - window.EJS_gameUrl = url; |
230 |
| - window.EJS_core = core; |
231 |
| - window.EJS_pathtodata = "data/"; |
232 |
| - window.EJS_startOnLoaded = true; |
233 |
| - window.EJS_DEBUG_XX = enableDebug; |
234 |
| - window.EJS_disableDatabases = true; |
235 |
| - |
236 |
| - script.src = "data/loader.js"; |
237 |
| - document.body.appendChild(script); |
238 |
| - } |
239 |
| - box.ondragover = () => box.setAttribute("drag", true); |
240 |
| - box.ondragleave = () => box.removeAttribute("drag"); |
| 21 | + EJS_player = "#game"; |
| 22 | + EJS_core = "mednafen_psx"; |
| 23 | + EJS_gameName = "RPG Maker (USA)"; |
| 24 | + EJS_color = "#000000"; |
| 25 | + EJS_startOnLoaded = false; |
| 26 | + EJS_pathtodata = "https://cdn.emulatorjs.org/stable/data/"; |
| 27 | + EJS_loadStateURL = "https://experi-mint.netlify.app/RPG Maker (USA).state"; |
| 28 | + EJS_gameUrl = "https://experi-mint.netlify.app/RPG Maker (USA).zip"; |
| 29 | + EJS_biosUrl = "https://experi-mint.netlify.app/scph5501.bin"; |
241 | 30 | </script>
|
| 31 | + <script src="https://cdn.emulatorjs.org/stable/data/loader.js"></script> |
242 | 32 | </body>
|
243 | 33 | </html>
|
0 commit comments