AEFeinstein / AEFeinstein/Super-2024-Swadge-FW

WebAssembly Support

Aperta
#421 4 commenti 0 reazioni 2 assegnatari Rivendicata da @dylwhich Vedi su GitHub
Next Year Tools
Lingua principale
C
Stelle
34
Fork
22
Merge medio
3g 15h
PR unite (30g)
10

Descrizione

## Summary

We should be able to run the Swadge Emulator in WebAssembly!

**Why?**
1. Reduced barrier to entry -- If WASM is supported, it would be possible for anyone with a GitHub account to go to https://github.dev/AEFeinstein/Super-2024-Swadge-FW/ and work on the Swadge without ever having to set up an environment on their local machine.
2. Easier to get mode feedback -- It's possible to [expose codespace ports publicly](https://docs.github.com/en/codespaces/developing-in-a-codespace/forwarding-ports-in-your-codespace#sharing-a-port), which means you can let someone try out a game you're actively developing by just sharing a link. No need to even commit, you can try out changes almost in real time!
3. It would be really neat!

## Technical Spec

Functionally this is pretty similar to the [SAO wasm emulator](https://github.com/cnlohr/Super-2024-Swadge-FW/tree/ch32v003programmer/tools/sandbox_test/test_programmer/sao047b/web). A few parts of the emulator implementation would need to be modified to support WebAssembly, in particular anything that does file I/O will need an implementation that uses some browser API instead. We could do the implementation in two stages, with the first stage being a minimum-viable implementation that renders to the screen and takes keyboard input, but doesn't support audio, saving data, etc. The second stage would be a more complete implementation with audio, NVS support, and potentially joystick/MIDI support, replay support, screenshots, and other goodies.

Minimum prereqs for "it works":
* [x] WASM-compatible rendering and key/mouse input (rawdraw)
* [ ] stdlibc implementation suitable for WASM
* [x] WASM build process for emulator

Stage 2:
* [ ] WASM backend for CNFA, or perhaps a custom implementation
* [x] alternative NVS implementation (LocalStorage)
* [ ] alternative joystick implementation (gamepad API)
* [ ] alternative MIDI implementation (WebMIDI)
* [ ] alternative ESPNOW implementation (WebSockets / a hosted relay server that handles "rooms")
* [ ] advanced emulator features that use files (replay, screenshots, screen recordings, opening MIDIs)
* [ ] pass args via URL, e.g. `https://example.com/?mode=Touch+Test` would be equivalent to `swadge_emulator --mode "Touch Test"`

## UI

## Mockups

## How to Test

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.