-
Notifications
You must be signed in to change notification settings - Fork 26
/
debug.html
532 lines (491 loc) · 19.6 KB
/
debug.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
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
<html>
<head>
<script>
function showDropdownList() {
document.getElementById("myDropdown").classList.toggle("show");
}
// Close the dropdown if the user clicks outside of it
window.onclick = function(event) {
if (!event.target.matches('.dropbtn')) {
var dropdowns = document.getElementsByClassName("dropdown-content");
var i;
for (i = 0; i < dropdowns.length; i++) {
var openDropdown = dropdowns[i];
if (openDropdown.classList.contains('show')) {
openDropdown.classList.remove('show');
}
}
}
}
</script>
<script>
var colors;
var step = 0;
//color table indices for:
// current color left
// next color left
// current color right
// next color right
var colorIndices = [0,1,2,3];
//transition speed
var gradientSpeed = 0.01;
function updateGradient()
{
if ( this['$'] === undefined || this['$'] === null) return;
var c0_0 = colors[colorIndices[0]];
var c0_1 = colors[colorIndices[1]];
var c1_0 = colors[colorIndices[2]];
var c1_1 = colors[colorIndices[3]];
var istep = 1 - step;
var r1 = Math.round(istep * c0_0[0] + step * c0_1[0]);
var g1 = Math.round(istep * c0_0[1] + step * c0_1[1]);
var b1 = Math.round(istep * c0_0[2] + step * c0_1[2]);
var color1 = "rgb("+r1+","+g1+","+b1+")";
var r2 = Math.round(istep * c1_0[0] + step * c1_1[0]);
var g2 = Math.round(istep * c1_0[1] + step * c1_1[1]);
var b2 = Math.round(istep * c1_0[2] + step * c1_1[2]);
var color2 = "rgb("+r2+","+g2+","+b2+")";
$('#gradient').css({
background: "-webkit-gradient(linear, left top, right top, from("+color1+"), to("+color2+"))"}).css({
background: "-moz-linear-gradient(left, "+color1+" 0%, "+color2+" 100%)"});
step += gradientSpeed;
if ( step >= 1 )
{
step %= 1;
colorIndices[0] = colorIndices[1];
colorIndices[2] = colorIndices[3];
//pick two new target color indices
//do not pick the same as the current one
colorIndices[1] = ( colorIndices[1] + Math.floor( 1 + Math.random() * (colors.length - 1))) % colors.length;
colorIndices[3] = ( colorIndices[3] + Math.floor( 1 + Math.random() * (colors.length - 1))) % colors.length;
}
}
var gradientBackgroundInterval = null;
function stopGradientBackground() {
clearInterval(gradientBackgroundInterval);
gradientBackgroundInterval = null;
}
function startGradientBackground() {
if (gradientBackgroundInterval == null) {
colors = new Array(
[Math.random()*192,Math.random()*192,Math.random()*192],
[Math.random()*192,Math.random()*192,Math.random()*192],
[Math.random()*192,Math.random()*192,Math.random()*192],
[Math.random()*192,Math.random()*192,Math.random()*192],
[Math.random()*192,Math.random()*192,Math.random()*192],
[Math.random()*192,Math.random()*192,Math.random()*192]);
gradientBackgroundInterval = setInterval(updateGradient,30);
}
}
</script>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<title>1964 and 1964js Home page</title>
<meta content="1964js - N64 emulator in JavaScript" property="og:title" />
<meta content="game" property="og:type" />
<meta content="http://www.1964js.com" property="og:url" />
<meta content="https://fbcdn-profile-a.akamaihd.net/hprofile-ak-snc4/373029_274941852620356_1206208449_n.jpg" property="og:image" />
<meta content="1964js" property="og:site_name" />
<meta content="1397141558" property="fb:admins" />
</head>
<body alink="#ff0000" bgcolor="#000000" link="#D8D8D8" onLoad="start1964({wireframe:true})" onunload="i1964js.stopEmulatorAndCleanup()" text="#ffffff" vlink="#D8D8D8">
<p></p>
<script id="vertex-shader" type="x-shader/x-vertex">
attribute vec4 aVertexPosition;
attribute vec4 aVertexColor;
attribute vec2 aTextureCoord;
uniform mat4 uMVMatrix;
uniform mat4 uPMatrix;
varying lowp vec4 vColor;
varying vec2 vTextureCoord;
void main(void) {
gl_Position = uPMatrix * uMVMatrix * aVertexPosition;
vColor = aVertexColor;
vTextureCoord = aTextureCoord;
}
</script>
<script id="fragment-shader" type="x-shader/x-fragment">
precision mediump float;
varying lowp vec4 vColor;
varying mediump vec2 vTextureCoord;
uniform sampler2D uSampler;
uniform int cycleType;
//uniform int otherModeL, otherModeH;
uniform int uCombineA0, uCombineB0, uCombineC0, uCombineD0;
uniform int uCombineA0a, uCombineB0a, uCombineC0a, uCombineD0a;
uniform int uCombineA1, uCombineB1, uCombineC1, uCombineD1;
uniform int uCombineA1a, uCombineB1a, uCombineC1a, uCombineD1a;
uniform int uAlphaTestEnabled;
uniform vec4 uPrimColor, uFillColor, uEnvColor, uBlendColor;
vec4 green = vec4(0.0, 1.0, 0.0, 1.0);
vec4 a0, b0, c0, d0;
vec4 a1, b1, c1, d1;
vec4 tex2d;
int combined=0;
int tex0=1;
int tex1=2;
int prim=3;
int shade=4;
int env=5;
void main(void)
{
if (cycleType == 3)
{
gl_FragColor = uFillColor;
}
else if (cycleType == 2)
{
gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.st));
}
else
{
tex2d = texture2D(uSampler, vec2(vTextureCoord.st));
a0 = b0 = c0 = d0 = vec4(1.0, 1.0, 1.0, 0.0);
if (uCombineA0 == tex0)
a0.rgb = tex2d.rgb;
if (uCombineA0a == tex0)
a0.a = tex2d.a;
if (uCombineB0 == tex0)
b0.rgb = tex2d.rgb;
if (uCombineB0a == tex0)
b0.a = tex2d.a;
if (uCombineC0 == tex0)
c0.rgb = tex2d.rgb;
if (uCombineC0a == tex0)
c0.a = tex2d.a;
if (uCombineD0 == tex0)
d0.rgb = tex2d.rgb;
if (uCombineD0a == tex0)
d0.a = tex2d.a;
if (uCombineA0 == tex1)
a0.rgb = tex2d.rgb;
if (uCombineA0a == tex1)
a0.a = tex2d.a;
if (uCombineB0 == tex1)
b0.rgb = tex2d.rgb;
if (uCombineB0a == tex1)
b0.a = tex2d.a;
if (uCombineC0 == tex1)
c0.rgb = tex2d.rgb;
if (uCombineC0a == tex1)
c0.a = tex2d.a;
if (uCombineD0 == tex1)
d0.rgb = tex2d.rgb;
if (uCombineD0a == tex1)
d0.a = tex2d.a;
if (uCombineA0 == prim)
a0.rgb = uPrimColor.rgb;
if (uCombineA0a == prim)
a0.a = uPrimColor.a;
if (uCombineB0 == prim)
b0.rgb = uPrimColor.rgb;
if (uCombineB0a == prim)
b0.a = uPrimColor.a;
if (uCombineC0 == prim)
c0.rgb = uPrimColor.rgb;
if (uCombineC0a == prim)
c0.a = uPrimColor.a;
if (uCombineD0 == prim)
d0.rgb = uPrimColor.rgb;
if (uCombineD0a == prim)
d0.a = uPrimColor.a;
if (uCombineA0 == shade)
a0.rgb = vColor.rgb;
if (uCombineA0a == shade)
a0.a = vColor.a;
if (uCombineB0 == shade)
b0.rgb = vColor.rgb;
if (uCombineB0a == shade)
b0.a = vColor.a;
if (uCombineC0 == shade)
c0.rgb = vColor.rgb;
if (uCombineC0a == shade)
c0.a = vColor.a;
if (uCombineD0 == shade)
d0.rgb = vColor.rgb;
if (uCombineD0a == shade)
d0.a = vColor.a;
if (uCombineA0 == env)
a0.rgb = uEnvColor.rgb;
if (uCombineA0a == env)
a0.a = uEnvColor.a;
if (uCombineB0 == env)
b0.rgb = uEnvColor.rgb;
if (uCombineB0a == env)
b0.a = uEnvColor.a;
if (uCombineC0 == env)
c0.rgb = uEnvColor.rgb;
if (uCombineC0a == env)
c0.a = uEnvColor.a;
if (uCombineD0 == env)
d0.rgb = uEnvColor.rgb;
if (uCombineD0a == env)
d0.a = uEnvColor.a;
// alpha combiner
if (uCombineC0a == 8)
c0.a = tex2d.a;
if (uCombineC0a == 9)
c0.a = tex2d.a;
if (uCombineC0a == 10)
c0.a = uPrimColor.a;
if (uCombineC0a == 11)
c0.a = vColor.a;
if (uCombineC0a == 12)
c0.a = uEnvColor.a;
// convert k4
//if (uCombineB0 == 7)
// b0.rgb = uPrimColor.rgb;
//if (uCombineB0a == 7)
// b0.a = uPrimColor.a;
// convert k5
//if (uCombineC0 == 15)
// c0.rgb = uPrimColor.rgb;
//if (uCombineC0a == 15)
// c0.a = uPrimColor.a;
if (uCombineA0 == 6)
a0.rgb = vec3(1.0, 1.0, 1.0);
if (uCombineA0a == 6)
a0.a = 1.0;
if (uCombineD0 == 6)
d0.rgb = vec3(1.0, 1.0, 1.0);
if (uCombineD0a == 6)
d0.a = 1.0;
if (uCombineD0 == 7)
d0.rgb = vec3(0.0, 0.0, 0.0);
if (uCombineD0a == 7)
d0.a = 0.0;
if (uCombineA0 >= 8 && uCombineA0 <= 15)
a0.rgb = vec3(0.0, 0.0, 0.0);
if (uCombineA0a >= 8 && uCombineA0a <= 15)
a0.a = 0.0;
if (uCombineB0 >= 8 && uCombineB0 <= 15)
b0.rgb = vec3(0.0, 0.0, 0.0);
if (uCombineB0a >= 8 && uCombineB0a <= 15)
b0.a = 0.0;
if (uCombineC0 >= 16 && uCombineC0 <= 31)
c0.rgb = vec3(0.0, 0.0, 0.0);
if (uCombineC0a >= 16 && uCombineC0a <= 31)
c0.a = 0.0;
//vec4 combined = (a0-b0) * c0 + d0;
gl_FragColor = (a0-b0) * c0 + d0;
// if (uAlphaTestEnabled == 1 && gl_FragColor.a < uBlendColor.a)
// discard;
if (cycleType == 1) //2-cycle
{
a1 = b1 = c1 = d1 = vec4(1.0, 1.0, 1.0, 0.0);
if (uCombineA1 == combined)
a1.rgb = gl_FragColor.rgb;
if (uCombineA1a == combined)
a1.a = gl_FragColor.a;
if (uCombineB1 == combined)
b1.rgb = gl_FragColor.rgb;
if (uCombineB1a == combined)
b1.a = gl_FragColor.a;
if (uCombineC1 == combined)
c1.rgb = gl_FragColor.rgb;
if (uCombineC1a == combined)
c1.a = gl_FragColor.a;
if (uCombineD1 == combined)
d1.rgb = gl_FragColor.rgb;
if (uCombineD1a == combined)
d1.a = gl_FragColor.a;
if (uCombineA1 == tex0)
a1.rgb = tex2d.rgb;
if (uCombineA1a == tex0)
a1.a = tex2d.a;
if (uCombineB1 == tex0)
b1.rgb = tex2d.rgb;
if (uCombineB1a == tex0)
b1.a = tex2d.a;
if (uCombineC1 == tex0)
c1.rgb = tex2d.rgb;
if (uCombineC1a == tex0)
c1.a = tex2d.a;
if (uCombineD1 == tex0)
d1.rgb = tex2d.rgb;
if (uCombineD1a == tex0)
d1.a = tex2d.a;
if (uCombineA1 == tex1)
a1.rgb = tex2d.rgb;
if (uCombineA1a == tex1)
a1.a = tex2d.a;
if (uCombineB1 == tex1)
b1.rgb = tex2d.rgb;
if (uCombineB1a == tex1)
b1.a = tex2d.a;
if (uCombineC1 == tex1)
c1.rgb = tex2d.rgb;
if (uCombineC1a == tex1)
c1.a = tex2d.a;
if (uCombineD1 == tex1)
d1.rgb = tex2d.rgb;
if (uCombineD1a == tex1)
d1.a = tex2d.a;
if (uCombineA1 == prim)
a1.rgb = uPrimColor.rgb;
if (uCombineA1a == prim)
a1.a = uPrimColor.a;
if (uCombineB1 == prim)
b1.rgb = uPrimColor.rgb;
if (uCombineB1a == prim)
b1.a = uPrimColor.a;
if (uCombineC1 == prim)
c1.rgb = uPrimColor.rgb;
if (uCombineC1a == prim)
c1.a = uPrimColor.a;
if (uCombineD1 == prim)
d1.rgb = uPrimColor.rgb;
if (uCombineD1a == prim)
d1.a = uPrimColor.a;
if (uCombineA1 == shade)
a1.rgb = vColor.rgb;
if (uCombineA1a == shade)
a1.a = vColor.a;
if (uCombineB1 == shade)
b1.rgb = vColor.rgb;
if (uCombineB1a == shade)
b1.a = vColor.a;
if (uCombineC1 == shade)
c1.rgb = vColor.rgb;
if (uCombineC1a == shade)
c1.a = vColor.a;
if (uCombineD1 == shade)
d1.rgb = vColor.rgb;
if (uCombineD1a == shade)
d1.a = vColor.a;
if (uCombineA1 == env)
a1.rgb = uEnvColor.rgb;
if (uCombineA1a == env)
a1.a = uEnvColor.a;
if (uCombineB1 == env)
b1.rgb = uEnvColor.rgb;
if (uCombineB1a == env)
b1.a = uEnvColor.a;
if (uCombineC1 == env)
c1.rgb = uEnvColor.rgb;
if (uCombineC1a == env)
c1.a = uEnvColor.a;
if (uCombineD1 == env)
d1.rgb = uEnvColor.rgb;
if (uCombineD1a == env)
d1.a = uEnvColor.a;
// alpha combiner
if (uCombineC1a == 7)
c1.a = gl_FragColor.a;
if (uCombineC1a == 8)
c1.a = tex2d.a;
if (uCombineC1a == 9)
c1.a = tex2d.a;
if (uCombineC1a == 10)
c1.a = uPrimColor.a;
if (uCombineC1a == 11)
c1.a = vColor.a;
if (uCombineC1a == 12)
c1.a = uEnvColor.a;
// convert k4
//if (uCombineB1 == 7)
// b1.rgb = uPrimColor.rgb;
//if (uCombineB1a == 7)
// b1.a = uPrimColor.a;
// convert k5
//if (uCombineC1 == 15)
// c1.rgb = uPrimColor.rgb;
//if (uCombineC1a == 15)
// c1.a = uPrimColor.a;
if (uCombineA1 == 6)
a1.rgb = vec3(1.0, 1.0, 1.0);
if (uCombineA1a == 6)
a1.a = 1.0;
if (uCombineD1 == 6)
d1.rgb = vec3(1.0, 1.0, 1.0);
if (uCombineD1a == 6)
d1.a = 1.0;
if (uCombineD1 == 7)
d1.rgb = vec3(0.0, 0.0, 0.0);
if (uCombineD1a == 7)
d1.a = 0.0;
if (uCombineA1 >= 8 && uCombineA1 <= 15)
a1.rgb = vec3(0.0, 0.0, 0.0);
if (uCombineA1a >= 8 && uCombineA1a <= 15)
a1.a = 0.0;
if (uCombineB1 >= 8 && uCombineB1 <= 15)
b1.rgb = vec3(0.0, 0.0, 0.0);
if (uCombineB1a >= 8 && uCombineB1a <= 15)
b1.a = 0.0;
if (uCombineC1 >= 16 && uCombineC1 <= 31)
c1.rgb = vec3(0.0, 0.0, 0.0);
if (uCombineC1a >= 16 && uCombineC1a <= 31)
c1.a = 0.0;
gl_FragColor = (a1-b1) * c1 + d1;
// gl_FragColor.a = 0.5;
// if (uAlphaTestEnabled == 1 && gl_FragColor.a < uBlendColor.a)
// discard;
}
}
}
</script>
<canvas height="240" id="Canvas" width="320"></canvas><canvas height="1024" id="Canvas3D" width="1024"></canvas>
<div id="user_panel">
<div id="gradient">
<span class="header"><a href="http://1964emu.emulation64.com">Get 1964 for Windows</a> <a href="http://1964js.com/blog/index.html">Blog</a> <a href="http://www.github.com/schibo/1964js">Code</a> <a href="http://hulkholden.github.com/n64js/">Try n64js too!</a></span>
<p style="font-size: 130%;">
1964js <span style="font-size: 10px; font-size: 40%;"> v0.4.9</span>
</p>
<p></p>
<div>
<div class="dropdown">
<button class="dropbtn" onclick="showDropdownList()"> Demos</button>
<div class="dropdown-content" id="myDropdown">
<a href="?rom=roms/unofficial/rotate.zip">Rotate</a><a href="?rom=roms/unofficial/chrome.zip">Chrome</a><a href="?rom=roms/unofficial/dextrose.zip">Dextrose</a><a href="?rom=roms/unofficial/n64stars.zip">N64 Stars</a><a href="?rom=roms/unofficial/liner.zip">Liner</a><a href="?rom=roms/unofficial/hardcode.zip">Hard Coded</a><a href="?rom=roms/unofficial/sp_crap.zip">Absolute Crap</a>
</div>
</div>
</div>
<div>
<br /><center>
<div class="dropbtn" style="position: relative; overflow: hidden; direction: ltr;background-color: #4CAF50; width:10vw; font-size: 1.5vw">
<div style="display: block; text-align: center">
Load ROM
</div>
<input class="file" id="files" name="file" onclick="this.value=null;" type="file" />
</div>
<span style="font-size: 10px; font-size: 50%"><br />Supports Super Mario 64 <br /></span></center>
</div>
<p style="margin-top: 2%;">
<input id="stretch" type="checkbox">stretch</input> <input checked="true" id="speedlimit" onclick="i1964js.onSpeedLimitChanged()" type="checkbox">speed limit </input> <input id="wireframe" type="checkbox">wireframe</input> <input id="repeatDList" type="checkbox">repeat DList </input>
</p>
<p></p>
<a href="https://www.google.com/chrome/" style="font-align:left;">Best with Chrome</a>
</div>
</div>
<script src="lib/jquery.min.js"></script>
<script src="obj/constants.js"></script>
<script src="lib/bitjs/io.js"></script>
<script src="lib/bitjs/archive.js"></script>
<script src="lib/BigInt-modded-forES6.js"></script>
<script src="lib/closure/goog/base.js"></script>
<script src="obj/1964.js"></script>
<script src="obj/helpers.js"></script>
<script src="obj/opcodeMap.js"></script>
<script src="obj/boot.js"></script>
<script src="lib/closure/goog/math/long.js"></script>
<script src="obj/pif.js"></script>
<script src="obj/pif_le.js"></script>
<script src="obj/keyboard.js"></script>
<script src="obj/memory.js"></script>
<script src="obj/memory_le.js"></script>
<script src="obj/gen.js"></script>
<script src="obj/audio.js"></script>
<script src="obj/dma.js"></script>
<script src="obj/dma_le.js"></script>
<script src="obj/interrupts.js"></script>
<script src="lib/glMatrix-0.9.5.min.js"></script>
<script src="lib/mainLoop.js"></script>
<script src="lib/webgl-utils.js"></script>
<script src="obj/renderer.js"></script>
<script src="obj/renderer_le.js"></script>
<script src="obj/videoHLE.js"></script>
<script src="obj/gfxHelpers.js"></script>
<script src="obj/gfxHelpers_le.js"></script>
<script src="obj/ui.js"></script>
<script src="obj/webGL.js"></script>
</body>
</html>