I use a function "base64ToArrayBuffer" to convert the var binaryData.
function base64ToArrayBuffer( base64 ) {
var raw = window.atob( base64 );
var rawLength = raw.length;
var array = new Uint8Array( new ArrayBuffer(rawLength) );
for( i = 0; i < rawLength; i++ ) {
array[ i ] = raw.charCodeAt( i );
}
return( array.buffer );
}
I try to init the emulator
var rom2;
var u8array = new Uint8Array(binaryData);
rom2 = new Array();
for(var i=0; i<u8array.length; i++)
{
rom2.push(u8array[i]);
}
Hello ,
I want to load a game on load of the page so.
I'v create a php page in place of html :)
Inside this the php part create a JS var with the binary64 encode of the file content.
<?php $binary_data = base64_encode( file_get_contents( "rom/game.pce" , false ) ); echo <<<EOF
EOF; ?>
function base64ToArrayBuffer( base64 ) { var raw = window.atob( base64 ); var rawLength = raw.length; var array = new Uint8Array( new ArrayBuffer(rawLength) ); for( i = 0; i < rawLength; i++ ) { array[ i ] = raw.charCodeAt( i ); } return( array.buffer ); }
I try to init the emulator
var rom2; var u8array = new Uint8Array(binaryData); rom2 = new Array(); for(var i=0; i<u8array.length; i++) { rom2.push(u8array[i]);
}
pce.Init(); pce.SetROM(rom2); Start();
Finaly it's start but it's really slow.
Do you have a solution for me ? :) Thanks.