@tmustier/pi-nes 0.2.36 → 0.2.37

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.
Files changed (2) hide show
  1. package/AGENTS.md +20 -12
  2. package/package.json +3 -2
package/AGENTS.md CHANGED
@@ -20,11 +20,12 @@ pi-nes/
20
20
  ├── config.ts # User config (~/.pi/nes/config.json)
21
21
  ├── paths.ts # Path resolution utilities
22
22
  ├── roms.ts # ROM directory listing
23
+ ├── rom-selector.ts # Filterable ROM picker UI
23
24
  ├── saves.ts # SRAM persistence
24
25
  └── native/
25
26
  ├── nes-core/ # Rust NES emulator addon (required)
26
- │ ├── Cargo.toml # Dependencies: vendored nes_rust, napi
27
- │ ├── vendor/nes_rust/ # Patched nes_rust crate (SRAM helpers)
27
+ │ ├── Cargo.toml # Dependencies: vendored nes_rust, napi, optional cpal
28
+ │ ├── vendor/nes_rust/ # Patched nes_rust crate (SRAM helpers + mapper fixes)
28
29
  │ ├── src/lib.rs # Exposes NativeNes class via napi-rs
29
30
  │ └── index.node # Compiled binary
30
31
  └── kitty-shm/ # Rust shared memory addon (optional)
@@ -34,7 +35,7 @@ pi-nes/
34
35
 
35
36
  ### Native Core
36
37
 
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.
38
+ The emulator uses the [`nes_rust`](https://crates.io/crates/nes_rust) crate (vendored + patched in `native/nes-core/vendor/nes_rust`) with [napi-rs](https://napi.rs) bindings. Optional audio uses a Rust-only backend (`cpal`) when built with `audio-cpal`.
38
39
 
39
40
  ### Vendored `nes_rust` workflow
40
41
 
@@ -46,12 +47,16 @@ The emulator uses the [`nes_rust`](https://crates.io/crates/nes_rust) crate (ven
46
47
  **API exposed to JavaScript:**
47
48
  - `new NativeNes()` - Create emulator instance
48
49
  - `setRom(Uint8Array)` - Load ROM data
49
- - `bootup()` / `reset()` - Start/restart emulation
50
+ - `bootup()` - Start emulation
50
51
  - `stepFrame()` - Advance one frame (~60fps)
52
+ - `refreshFramebuffer()` - Copy framebuffer from core
51
53
  - `pressButton(n)` / `releaseButton(n)` - Controller input (0=select, 1=start, 2=A, 3=B, 4-7=dpad)
54
+ - `setVideoFilter(mode)` - 0=off, 1=ntsc-composite, 2=ntsc-svideo, 3=ntsc-rgb
55
+ - `setAudioEnabled(bool)` - Returns false if audio backend unavailable
52
56
  - `hasBatteryBackedRam()` - Whether the ROM supports battery SRAM
53
57
  - `getSram()` / `setSram(Uint8Array)` - Read/write SRAM
54
58
  - `isSramDirty()` / `markSramSaved()` - Dirty tracking for SRAM persistence
59
+ - `getDebugState()` - CPU/mapper debug info
55
60
  - `getFramebuffer()` - Returns RGB pixel data (256×240×3 bytes, zero-copy via external buffer)
56
61
 
57
62
  ### Rendering Pipeline
@@ -67,7 +72,7 @@ NES Core → RGB framebuffer (256×240×3) → Renderer → Terminal
67
72
 
68
73
  - Image mode (`renderer: "image"`) runs at ~30fps to keep emulation stable
69
74
  - Text mode (`renderer: "text"`) runs at ~60fps in an overlay
70
- - Image mode uses near-fullscreen (90% height) because Kitty graphics can't composite in overlays
75
+ - Image mode uses a windowed overlay (90% width/height) to avoid Kitty full-screen artifacts
71
76
 
72
77
  ### Session Lifecycle
73
78
 
@@ -86,8 +91,11 @@ Requires Rust toolchain (cargo + rustc).
86
91
  cd extensions/nes/native/nes-core
87
92
  npm install && npm run build
88
93
 
94
+ # NES core with audio (optional)
95
+ npm run build:audio
96
+
89
97
  # Kitty shared memory (optional, faster rendering)
90
- cd extensions/nes/native/kitty-shm
98
+ cd ../kitty-shm
91
99
  npm install && npm run build
92
100
  ```
93
101
 
@@ -95,13 +103,13 @@ The addons compile to `index.node`. The JS wrapper (`index.js`) tries to load it
95
103
 
96
104
  ## Known Limitations
97
105
 
98
- - **No audio** — `enableAudio` config exists but no audio backend is implemented
99
- - **No save states** — Only battery-backed SRAM saves are persisted
100
- - **SRAM for native core** — Tracked in issue #3
106
+ - **Audio is opt-in** — Requires a native core built with `audio-cpal` and `enableAudio: true`.
107
+ - **Overlay flicker** — Kitty overlay can show a 1-line flicker at overlay boundaries (see issue #9).
108
+ - **No save states** — Only battery-backed SRAM saves are persisted.
101
109
 
102
110
  ## Release and Publishing
103
111
 
104
- ## Version Bumps (Git + npm)
112
+ ### Version Bumps (Git + npm)
105
113
 
106
114
  Preferred flow (creates a git tag):
107
115
 
@@ -127,7 +135,7 @@ git push
127
135
  git push --tags
128
136
  ```
129
137
 
130
- ## npm Publish
138
+ ### npm Publish
131
139
 
132
140
  ```bash
133
141
  npm login
@@ -140,7 +148,7 @@ If you need to validate the tarball first:
140
148
  npm pack
141
149
  ```
142
150
 
143
- ## GitHub Release Notes
151
+ ### GitHub Release Notes
144
152
 
145
153
  ```bash
146
154
  gh release create vX.Y.Z --title "vX.Y.Z" --notes "<release notes>"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tmustier/pi-nes",
3
- "version": "0.2.36",
3
+ "version": "0.2.37",
4
4
  "description": "NES emulator extension for pi",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -33,6 +33,7 @@
33
33
  "pi": {
34
34
  "extensions": [
35
35
  "./extensions/nes"
36
- ]
36
+ ],
37
+ "image": "https://raw.githubusercontent.com/tmustier/pi-nes/main/assets/demo.gif"
37
38
  }
38
39
  }