retroemu 0.1.0 → 0.1.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "retroemu",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Terminal retro game emulator using libretro WASM cores",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -43,7 +43,7 @@
43
43
  "dependencies": {
44
44
  "gamepad-node": "^1.3.0",
45
45
  "@kmamal/sdl": "^0.11.13",
46
- "chafa-wasm": "^0.3.2",
46
+ "@monteslu/chafa-wasm": "^0.4.0",
47
47
  "yauzl": "^3.2.0"
48
48
  },
49
49
  "devDependencies": {
@@ -165,12 +165,17 @@ export class InputManager {
165
165
  process.stdin.setEncoding('utf8');
166
166
 
167
167
  process.stdin.on('data', (key) => {
168
- // Ctrl+C to exit
169
- if (key === '\u0003') {
168
+ // Ctrl+C or ESC to exit
169
+ if (key === '\u0003' || (key === '\u001b' && key.length === 1)) {
170
170
  process.emit('SIGINT');
171
171
  return;
172
172
  }
173
173
 
174
+ // F1 = reset, F5 = save state, F7 = load state
175
+ if (key === '\u001b[11~') process.emit('emu:reset');
176
+ if (key === '\u001b[15~') process.emit('emu:save');
177
+ if (key === '\u001b[18~') process.emit('emu:load');
178
+
174
179
  // Handle arrow keys (escape sequences)
175
180
  if (key === '\u001b[A') {
176
181
  this._pressKey('up');
@@ -216,6 +221,7 @@ export class InputManager {
216
221
 
217
222
  if (process.stdin.isTTY) {
218
223
  process.stdin.setRawMode(false);
224
+ process.stdin.removeAllListeners('data');
219
225
  process.stdin.pause();
220
226
  }
221
227
  }
@@ -69,7 +69,7 @@ function createSymbolMap(mode) {
69
69
  }
70
70
 
71
71
  async function initChafa() {
72
- const chafaModule = await import('chafa-wasm');
72
+ const chafaModule = await import('@monteslu/chafa-wasm');
73
73
  chafa = chafaModule.default || chafaModule;
74
74
  if (typeof chafa === 'function') {
75
75
  chafa = await chafa();