-
-
+
+
+
+
+
+
DPad: Arrow keys
B button: Z, A button: X, Select: Tab / C, Start: Return / V
diff --git a/src/lib/NES.svelte b/src/lib/NES.svelte
index 87fbf50..8be1c1e 100644
--- a/src/lib/NES.svelte
+++ b/src/lib/NES.svelte
@@ -3,7 +3,7 @@
import { onMount } from 'svelte';
let nes = $state();
- let { rom } = $props();
+ let { rom, opts } = $props();
const SCREEN_WIDTH = 256;
const SCREEN_HEIGHT = 240;
@@ -81,10 +81,10 @@
}
let emu = new jsnes.NES({
- onFrame: function(framebuffer_24){
+ onFrame: function(framebuffer_24) {
for(var i = 0; i < FRAMEBUFFER_SIZE; i++) framebuffer_u32[i] = 0xFF000000 | framebuffer_24[i];
},
- onAudioSample: function(l, r){
+ onAudioSample: function(l, r) {
audio_samples_L[audio_write_cursor] = l;
audio_samples_R[audio_write_cursor] = r;
audio_write_cursor = (audio_write_cursor + 1) & SAMPLE_MASK;
@@ -105,6 +105,7 @@
canvas_ctx.putImageData(image, 0, 0);
}
nes = {
+ baseOpts: emu.opts,
emu,
activate() {
this.stopAnimating();
@@ -140,6 +141,11 @@
}
}
})
+ $effect(() => {
+ if (nes) {
+ nes.emu.opts = { ...opts, ...nes.baseOpts };
+ }
+ })