@tmustier/pi-nes 0.2.7 → 0.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +6 -2
- package/extensions/nes/index.ts +5 -5
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -23,7 +23,8 @@ pi-nes/
|
|
|
23
23
|
├── saves.ts # SRAM persistence
|
|
24
24
|
└── native/
|
|
25
25
|
├── nes-core/ # Rust NES emulator addon (required)
|
|
26
|
-
│ ├── Cargo.toml # Dependencies: nes_rust, napi
|
|
26
|
+
│ ├── Cargo.toml # Dependencies: vendored nes_rust, napi
|
|
27
|
+
│ ├── vendor/nes_rust/ # Patched nes_rust crate (SRAM helpers)
|
|
27
28
|
│ ├── src/lib.rs # Exposes NativeNes class via napi-rs
|
|
28
29
|
│ └── index.node # Compiled binary
|
|
29
30
|
└── kitty-shm/ # Rust shared memory addon (optional)
|
|
@@ -33,7 +34,7 @@ pi-nes/
|
|
|
33
34
|
|
|
34
35
|
### Native Core
|
|
35
36
|
|
|
36
|
-
The emulator uses the [`nes_rust`](https://crates.io/crates/nes_rust) crate with [napi-rs](https://napi.rs) bindings.
|
|
37
|
+
The emulator uses the [`nes_rust`](https://crates.io/crates/nes_rust) crate (vendored + patched in `native/nes-core/vendor/nes_rust` for SRAM helpers) with [napi-rs](https://napi.rs) bindings.
|
|
37
38
|
|
|
38
39
|
**API exposed to JavaScript:**
|
|
39
40
|
- `new NativeNes()` - Create emulator instance
|
|
@@ -41,6 +42,9 @@ The emulator uses the [`nes_rust`](https://crates.io/crates/nes_rust) crate with
|
|
|
41
42
|
- `bootup()` / `reset()` - Start/restart emulation
|
|
42
43
|
- `stepFrame()` - Advance one frame (~60fps)
|
|
43
44
|
- `pressButton(n)` / `releaseButton(n)` - Controller input (0=select, 1=start, 2=A, 3=B, 4-7=dpad)
|
|
45
|
+
- `hasBatteryBackedRam()` - Whether the ROM supports battery SRAM
|
|
46
|
+
- `getSram()` / `setSram(Uint8Array)` - Read/write SRAM
|
|
47
|
+
- `isSramDirty()` / `markSramSaved()` - Dirty tracking for SRAM persistence
|
|
44
48
|
- `getFramebuffer()` - Returns RGB pixel data (256×240×3 bytes, zero-copy via external buffer)
|
|
45
49
|
|
|
46
50
|
### Rendering Pipeline
|
package/extensions/nes/index.ts
CHANGED
|
@@ -175,8 +175,8 @@ async function configureWithWizard(
|
|
|
175
175
|
}
|
|
176
176
|
|
|
177
177
|
const qualityChoice = await ctx.ui.select("Quality (pixel scale)", [
|
|
178
|
-
"Low (1.0) - faster",
|
|
179
178
|
"Balanced (1.2) - recommended",
|
|
179
|
+
"Low (1.0) - faster",
|
|
180
180
|
"High (1.5) - sharper",
|
|
181
181
|
"Custom...",
|
|
182
182
|
]);
|
|
@@ -225,18 +225,18 @@ async function editConfig(ctx: ExtensionCommandContext): Promise<void> {
|
|
|
225
225
|
}
|
|
226
226
|
const config = await loadConfig();
|
|
227
227
|
const choice = await ctx.ui.select("NES configuration", [
|
|
228
|
-
"
|
|
229
|
-
"
|
|
228
|
+
"Quick setup",
|
|
229
|
+
"Advanced (edit config JSON)",
|
|
230
230
|
"Reset to defaults",
|
|
231
231
|
]);
|
|
232
232
|
if (!choice) {
|
|
233
233
|
return;
|
|
234
234
|
}
|
|
235
|
-
if (choice === "
|
|
235
|
+
if (choice === "Quick setup") {
|
|
236
236
|
await configureWithWizard(ctx, config);
|
|
237
237
|
return;
|
|
238
238
|
}
|
|
239
|
-
if (choice === "
|
|
239
|
+
if (choice === "Advanced (edit config JSON)") {
|
|
240
240
|
await editConfigJson(ctx, config);
|
|
241
241
|
return;
|
|
242
242
|
}
|