File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,11 @@ function runGameboy() {
39
39
GameBoyAudioNode . run ( ) ;
40
40
}
41
41
42
+ var resultHash = gameboy . canvas . resultHash ;
43
+
42
44
resetGlobalVariables ( ) ;
45
+
46
+ return resultHash ;
43
47
}
44
48
45
49
function tearDownGameboy ( ) {
@@ -56,7 +60,8 @@ var expectedGameboyStateStr =
56
60
57
61
var GameBoyWindow = { } ;
58
62
59
- function GameBoyContext ( ) {
63
+ function GameBoyContext ( canvas ) {
64
+
60
65
this . createBuffer = function ( ) {
61
66
return new Buffer ( ) ;
62
67
}
@@ -69,20 +74,21 @@ function GameBoyContext() {
69
74
this . putImageData = function ( buffer , x , y ) {
70
75
var sum = 0 ;
71
76
for ( var i = 0 ; i < buffer . data . length ; i ++ ) {
72
- sum += i * buffer . data [ i ] ;
73
- sum = sum % 1000 ;
77
+ sum ^= ( i * buffer . data [ i ] ) | 0 ;
74
78
}
79
+ canvas . resultHash ^= sum ;
75
80
}
76
81
this . drawImage = function ( ) { }
77
82
} ;
78
83
79
84
function GameBoyCanvas ( ) {
80
85
this . getContext = function ( ) {
81
- return new GameBoyContext ( ) ;
86
+ return new GameBoyContext ( this ) ;
82
87
}
83
88
this . width = 160 ;
84
89
this . height = 144 ;
85
90
this . style = { visibility : "visibile" } ;
91
+ this . resultHash = 0x1a2b3c4f ;
86
92
}
87
93
88
94
function cout ( message , colorIndex ) {
Original file line number Diff line number Diff line change @@ -9783,6 +9783,6 @@ setupGameboy();
9783
9783
9784
9784
class Benchmark {
9785
9785
runIteration ( ) {
9786
- runGameboy ( ) ;
9786
+ this . result = runGameboy ( ) ;
9787
9787
}
9788
9788
}
You can’t perform that action at this time.
0 commit comments