Can anyone tell me what is wrong with the follwing function? It reads the rom and base64 encodes the file but for some reason it won't load. vice.js
The console log shows the following:
UTOSTART: Autodetecting image type of disk-image.d64'. Filesystem Image: Error - Cannot open file disk-image.d64'.
Tape: Error - Cannot open file disk-image.d64' AUTOSTART: Error - Cannot open disk-image.d64'.
AUTOSTART: Error - `disk-image.d64' is not a valid file.
// Convert file to base64 string
function loadFiles(){
var xhr = new XMLHttpRequest();
xhr.open("GET", 'roms/last_ninja_s1.g64', true);
xhr.responseType = "blob";
xhr.onload = function () {
var reader = new FileReader();
reader.onload = function(event) {
var base64encoded = event.target.result;
var base64array = base64encoded.split(',');
var base64EncodedFile = base64array[1];
console.log(base64EncodedFile);
FS.createDataFile('/', 'disk-image.d64', window.atob(base64EncodedFile), true, true);
}
var file = this.response;
reader.readAsDataURL(file);
};
xhr.send();
}
thanks.
Can anyone tell me what is wrong with the follwing function? It reads the rom and base64 encodes the file but for some reason it won't load. vice.js
The console log shows the following:
UTOSTART: Autodetecting image type of
disk-image.d64'. Filesystem Image: Error - Cannot open filedisk-image.d64'.Tape: Error - Cannot open file
disk-image.d64' AUTOSTART: Error - Cannot opendisk-image.d64'.AUTOSTART: Error - `disk-image.d64' is not a valid file.
// Convert file to base64 string
function loadFiles(){
var xhr = new XMLHttpRequest();
xhr.open("GET", 'roms/last_ninja_s1.g64', true);
xhr.responseType = "blob";
xhr.onload = function () {
var reader = new FileReader();
reader.onload = function(event) {
var base64encoded = event.target.result;
var base64array = base64encoded.split(',');
var base64EncodedFile = base64array[1];
console.log(base64EncodedFile);
FS.createDataFile('/', 'disk-image.d64', window.atob(base64EncodedFile), true, true);
}
var file = this.response;
reader.readAsDataURL(file);
};
xhr.send();
}
thanks.