forked from zixan/GameBoy-Online
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
417 lines (417 loc) · 15.7 KB
/
index.php
File metadata and controls
417 lines (417 loc) · 15.7 KB
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
415
416
417
<?php
define(CSSDIR, 'css');
define(JSDIR, 'js');
require_once('./res/framework.php');
class GameBoy extends site {
function start_processing() {
$this->title = 'GameBoy Online';
$this->script = '
DEBUG_MESSAGES = true;
DEBUG_WINDOWING = false;
';
$this->script_alt = array(
$this->server->convert_out_of_set_chars($this->server->url['folder'].JSDIR.'/other/windowStack.js'),
$this->server->convert_out_of_set_chars($this->server->url['folder'].JSDIR.'/other/terminal.js'),
$this->server->convert_out_of_set_chars($this->server->url['folder'].JSDIR.'/other/opacity.js'),
$this->server->convert_out_of_set_chars($this->server->url['folder'].JSDIR.'/other/gui.js'),
$this->server->convert_out_of_set_chars($this->server->url['folder'].JSDIR.'/other/BMPCanvas.js'),
$this->server->convert_out_of_set_chars($this->server->url['folder'].JSDIR.'/other/base64.js'),
$this->server->convert_out_of_set_chars($this->server->url['folder'].JSDIR.'/other/transportHandler.js'),
$this->server->convert_out_of_set_chars($this->server->url['folder'].JSDIR.'/other/waveAudio.js'),
$this->server->convert_out_of_set_chars($this->server->url['folder'].JSDIR.'/other/audioRunner.js'),
$this->server->convert_out_of_set_chars($this->server->url['folder'].JSDIR.'/other/json2.js'),
$this->server->convert_out_of_set_chars($this->server->url['folder'].JSDIR.'/GameBoyCore.js'),
$this->server->convert_out_of_set_chars($this->server->url['folder'].JSDIR.'/GameBoyIO.js')
);
$this->meta = array('viewport'=>'initial-scale=1.0;width=640;user-scalable=no;');
$this->style = '@import url("'.$this->server->convert_out_of_set_chars($this->server->url['folder'].CSSDIR.'/GameBoy.css.php').(($this->server->get('border-radius') == 'true') ? '?rounded=true' : '').'");';
$this->manifest = $this->server->convert_out_of_set_chars($this->server->url['folder'].'gameboy.manifest');
}
function body_render() {
$this->startElement('div');
$this->writeAttribute('id', 'GameBoy');
$this->writeAttribute('class', 'window');
$this->startElement('div');
$this->writeAttribute('class', 'menubar');
$this->startElement('span');
$this->writeAttribute('id', 'GameBoy_file_menu');
$this->text('File');
$this->endElement();
$this->startElement('span');
$this->writeAttribute('id', 'GameBoy_settings_menu');
$this->text('Settings');
$this->endElement();
$this->startElement('span');
$this->writeAttribute('id', 'GameBoy_view_menu');
$this->text('View');
$this->endElement();
$this->startElement('span');
$this->writeAttribute('id', 'GameBoy_about_menu');
$this->text('About');
$this->endElement();
$this->endElement();
$this->startElement('div');
$this->writeAttribute('id', 'gfx');
$this->startElement('canvas');
$this->endElement();
$this->startElement('div');
$this->writeAttribute('id', 'canvasAltContainer');
$this->endElement();
$this->startElement('span');
$this->writeAttribute('id', 'title');
$this->text('GameBoy');
$this->endElement();
$this->startElement('span');
$this->writeAttribute('id', 'port_title');
$this->text('Online');
$this->endElement();
$this->endElement();
$this->endElement();
$this->startElement('div');
$this->writeAttribute('id', 'terminal');
$this->writeAttribute('class', 'window');
$this->startElement('div');
$this->writeAttribute('id', 'terminal_output');
$this->endElement();
$this->startElement('div');
$this->writeAttribute('class', 'button_rack');
$this->startElement('button');
$this->writeAttribute('id', 'terminal_clear_button');
$this->writeAttribute('class', 'left');
$this->text('Clear Messages');
$this->endElement();
$this->startElement('button');
$this->writeAttribute('id', 'terminal_close_button');
$this->writeAttribute('class', 'right');
$this->text('Close Terminal');
$this->endElement();
$this->endElement();
$this->endElement();
$this->startElement('div');
$this->writeAttribute('id', 'about');
$this->writeAttribute('class', 'window');
$this->startElement('div');
$this->writeAttribute('id', 'about_message');
$this->startElement('h1');
$this->text('GameBoy Online');
$this->endElement();
$this->startElement('p');
$this->text('This is a GameBoy Color emulator written in JavaScript, with small portions of code ported from MeBoy.');
$this->endElement();
$this->startElement('p');
$this->text('The audio backend attempts to use the Mozilla proprietary mozWriteAudio first, then if necessary falls back to WAV PCM formatted audio in browsers that implement it through data URIs.');
$this->endElement();
$this->startElement('p');
$this->text('A browser that can use the CanvasPixelArray implementation of the canvas element or can display BMP formatted images through data URIs is required to run the graphics display.');
$this->endElement();
$this->startElement('p');
$this->text('Save states are implemented through the window.localStorage object, and are serialized/deserialized through JSON.');
$this->text(' In order for save states to work properly on most browsers, you need set the maximum size limit for DOM storage higher, to meet the needs of the emulator\'s save data size.');
$this->endElement();
$this->startElement('p');
$this->text('For the reference below, this site is not affiliated with it , nor endorses any actions by it.
Please note that downloading and obtaining GameBoy and GameBoy Color rom files may entail illegal activities, and as such are not endorsed and are done at your own risk.');
$this->endElement();
$this->startElement('p');
$this->text('For more information about MeBoy and its source code, visit ');
$this->startElement('a');
$this->writeAttribute('href', 'http://arktos.se/meboy/');
$this->writeAttribute('target', '_blank');
$this->text('http://arktos.se/meboy/');
$this->endElement();
$this->text('.');
$this->endElement();
$this->endElement();
$this->startElement('div');
$this->writeAttribute('class', 'button_rack');
$this->startElement('button');
$this->writeAttribute('id', 'about_close_button');
$this->writeAttribute('class', 'center');
$this->text('Close Popup');
$this->endElement();
$this->endElement();
$this->endElement();
$this->startElement('div');
$this->writeAttribute('class', 'window');
$this->writeAttribute('id', 'settings');
$this->startElement('div');
$this->writeAttribute('id', 'toggle_settings');
$this->startElement('div');
$this->writeAttribute('class', 'setting');
$this->startElement('span');
$this->text('Enable Sound (Experimental):');
$this->endElement();
$this->startElement('input');
$this->writeAttribute('type', 'checkbox');
$this->writeAttribute('checked', 'checked');
$this->writeAttribute('id', 'enable_sound');
$this->endElement();
$this->endElement();
$this->startElement('div');
$this->writeAttribute('class', 'setting');
$this->startElement('span');
$this->text('Force Mono Sound:');
$this->endElement();
$this->startElement('input');
$this->writeAttribute('type', 'checkbox');
$this->writeAttribute('id', 'enable_mono_sound');
$this->endElement();
$this->endElement();
$this->startElement('div');
$this->writeAttribute('class', 'setting');
$this->startElement('span');
$this->text('GB mode has priority over GBC mode:');
$this->endElement();
$this->startElement('input');
$this->writeAttribute('type', 'checkbox');
$this->writeAttribute('id', 'disable_colors');
$this->endElement();
$this->endElement();
$this->startElement('div');
$this->writeAttribute('class', 'setting');
$this->startElement('span');
$this->text('Use GBC BIOS (Note: Overrides GB priority):');
$this->endElement();
$this->startElement('input');
$this->writeAttribute('type', 'checkbox');
$this->writeAttribute('checked', 'checked');
$this->writeAttribute('id', 'enable_gbc_bios');
$this->endElement();
$this->endElement();
$this->startElement('div');
$this->writeAttribute('class', 'setting');
$this->startElement('span');
$this->text('The data URI BMP method has priority over the canvas tag method:');
$this->endElement();
$this->startElement('input');
$this->writeAttribute('type', 'checkbox');
$this->writeAttribute('id', 'bmp_method');
$this->endElement();
$this->endElement();
$this->startElement('div');
$this->writeAttribute('class', 'setting');
$this->startElement('span');
$this->text('Auto frame skip:');
$this->endElement();
$this->startElement('input');
$this->writeAttribute('type', 'checkbox');
$this->writeAttribute('id', 'auto_frameskip');
$this->writeAttribute('checked', 'checked');
$this->endElement();
$this->endElement();
$this->startElement('div');
$this->writeAttribute('class', 'setting');
$this->startElement('span');
$this->text('Override ROM only cartridge typing to MBC1:');
$this->endElement();
$this->startElement('input');
$this->writeAttribute('type', 'checkbox');
$this->writeAttribute('checked', 'checked');
$this->writeAttribute('id', 'rom_only_override');
$this->endElement();
$this->endElement();
$this->startElement('div');
$this->writeAttribute('class', 'setting');
$this->startElement('span');
$this->text('Always allow reading and writing to the MBC banks:');
$this->endElement();
$this->startElement('input');
$this->writeAttribute('type', 'checkbox');
$this->writeAttribute('checked', 'checked');
$this->writeAttribute('id', 'mbc_enable_override');
$this->endElement();
$this->endElement();
$this->startElement('div');
$this->writeAttribute('class', 'setting');
$this->startElement('span');
$this->text('Colorize Classic GameBoy Palettes:');
$this->endElement();
$this->startElement('input');
$this->writeAttribute('type', 'checkbox');
$this->writeAttribute('checked', 'checked');
$this->writeAttribute('id', 'enable_colorization');
$this->endElement();
$this->endElement();
$this->startElement('div');
$this->writeAttribute('class', 'setting');
$this->startElement('span');
$this->text('Minimal view on fullscreen:');
$this->endElement();
$this->startElement('input');
$this->writeAttribute('type', 'checkbox');
$this->writeAttribute('checked', 'checked');
$this->writeAttribute('id', 'do_minimal');
$this->endElement();
$this->endElement();
$this->startElement('div');
$this->writeAttribute('class', 'setting');
$this->startElement('span');
$this->text('Resize canvas directly in JavaScript:');
$this->endElement();
$this->startElement('input');
$this->writeAttribute('type', 'checkbox');
$this->writeAttribute('id', 'software_resizing');
$this->endElement();
$this->endElement();
$this->startElement('div');
$this->writeAttribute('class', 'setting');
$this->startElement('span');
$this->text('Disallow typed arrays to be used:');
$this->endElement();
$this->startElement('input');
$this->writeAttribute('type', 'checkbox');
$this->writeAttribute('id', 'typed_arrays_disallow');
$this->endElement();
$this->endElement();
$this->endElement();
$this->startElement('div');
$this->writeAttribute('class', 'button_rack');
$this->startElement('button');
$this->writeAttribute('id', 'settings_close_button');
$this->writeAttribute('class', 'center');
$this->text('Close Settings');
$this->endElement();
$this->endElement();
$this->endElement();
$this->startElement('ul');
$this->writeAttribute('class', 'menu');
$this->writeAttribute('id', 'GameBoy_file_popup');
$this->startElement('li');
$this->text('Open As');
$this->startElement('ul');
$this->writeAttribute('class', 'menu');
$this->startElement('li');
$this->writeAttribute('id', 'data_uri_clicker');
$this->text('Base 64 Encoding');
$this->endElement();
$this->startElement('li');
$this->writeAttribute('id', 'external_file_clicker');
$this->text('URL Address');
$this->endElement();
$this->startElement('li');
$this->writeAttribute('id', 'internal_file_clicker');
$this->text('Local File');
$this->endElement();
$this->startElement('li');
$this->writeAttribute('id', 'open_saved_clicker');
$this->text('Saved State');
$this->startElement('ul');
$this->writeAttribute('id', 'save_states');
$this->writeAttribute('class', 'menu');
$this->endElement();
$this->endElement();
$this->endElement();
$this->endElement();
$this->startElement('li');
$this->writeAttribute('id', 'save_state_clicker');
$this->text('Save State');
$this->endElement();
$this->startElement('li');
$this->writeAttribute('id', 'restart_cpu_clicker');
$this->text('Restart');
$this->endElement();
$this->startElement('li');
$this->writeAttribute('id', 'run_cpu_clicker');
$this->text('Resume');
$this->endElement();
$this->startElement('li');
$this->writeAttribute('id', 'kill_cpu_clicker');
$this->text('Pause');
$this->endElement();
$this->endElement();
$this->startElement('ul');
$this->writeAttribute('class', 'menu');
$this->writeAttribute('id', 'GameBoy_view_popup');
$this->startElement('li');
$this->writeAttribute('id', 'view_terminal');
$this->text('Terminal');
$this->endElement();
$this->startElement('li');
$this->writeAttribute('id', 'view_instructions');
$this->text('Instructions');
$this->endElement();
$this->startElement('li');
$this->writeAttribute('id', 'view_fullscreen');
$this->text('Fullscreen Mode');
$this->endElement();
$this->endElement();
$this->startElement('div');
$this->writeAttribute('id', 'input_select');
$this->writeAttribute('class', 'window');
$this->startElement('form');
$this->startElement('input');
$this->writeAttribute('type', 'file');
$this->writeAttribute('id', 'local_file_open');
$this->endElement();
$this->endElement();
$this->startElement('div');
$this->writeAttribute('class', 'button_rack');
$this->startElement('button');
$this->writeAttribute('id', 'input_select_close_button');
$this->writeAttribute('class', 'center');
$this->text('Close File Input');
$this->endElement();
$this->endElement();
$this->endElement();
$this->startElement('div');
$this->writeAttribute('id', 'instructions');
$this->writeAttribute('class', 'window');
$this->startElement('div');
$this->writeAttribute('id', 'keycodes');
$this->startElement('h1');
$this->text('Keyboard Controls:');
$this->endElement();
$this->startElement('ul');
$this->startElement('li');
$this->text('X is A.');
$this->endElement();
$this->startElement('li');
$this->text('Z is B.');
$this->endElement();
$this->startElement('li');
$this->text('Shift is Select.');
$this->endElement();
$this->startElement('li');
$this->text('Enter is Start.');
$this->endElement();
$this->startElement('li');
$this->text('The d-pad is the control pad.');
$this->endElement();
$this->startElement('li');
$this->text('The escape key (esc) allows you to get in and out of fullscreen mode.');
$this->endElement();
$this->endElement();
$this->endElement();
$this->startElement('div');
$this->writeAttribute('class', 'button_rack');
$this->startElement('button');
$this->writeAttribute('id', 'instructions_close_button');
$this->writeAttribute('class', 'center');
$this->text('Close Instructions');
$this->endElement();
$this->endElement();
$this->endElement();
$this->startElement('div');
$this->writeAttribute('id', 'fullscreenContainer');
$this->startElement('canvas');
$this->writeAttribute('id', 'fullscreen');
$this->writeAttribute('class', 'maximum');
$this->endElement();
$this->endElement();
$this->startElement('script');
$this->writeAttribute('type', 'text/javascript');
$this->text('
try {
addEvent("DOMContentLoaded", document, windowingPreInitUnsafe);
addEvent("readystatechange", document, windowingPreInitSafe);
addEvent("load", document, windowingPreInitUnsafe);
}
catch (error) {
alert("Could not initialize the emulator properly. Please try using a standards compliant browser.");
}
');
$this->endElement();
}
}
$site = new GameBoy();
?>