You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using the Vanilla JS version of JSNES and modified code from the embeded rom example. I tried to get it to open roms encoded as a byte array from nes.loadRom but couldn't get it to work at all.
I ended up having to create a blob from the URL, and then I created an object URL of that blob. then passed the url to this function from the example:
function nes_load_url(canvas_id, path) {
nes_init(canvas_id);
var req = new XMLHttpRequest();
req.open("GET", path);
req.overrideMimeType("text/plain; charset=x-user-defined");
req.onerror = () => console.log(`Error loading ${path}: ${req.statusText}`);
req.onload = function () {
if (this.status === 200) {
nes_boot(this.responseText);
} else if (this.status === 0) {
// Aborted, so ignore error
} else {
req.onerror();
}
};
req.send();
}
Its great that I got my code to read and boot roms, but loading a rom from an object url instead of a byte array seems redundant. Maybe I was doing something wrong.
The text was updated successfully, but these errors were encountered:
I'm using the Vanilla JS version of JSNES and modified code from the embeded rom example. I tried to get it to open roms encoded as a byte array from nes.loadRom but couldn't get it to work at all.
I ended up having to create a blob from the URL, and then I created an object URL of that blob. then passed the url to this function from the example:
Its great that I got my code to read and boot roms, but loading a rom from an object url instead of a byte array seems redundant. Maybe I was doing something wrong.
The text was updated successfully, but these errors were encountered: