Skip to content

Conversation

@eddmann
Copy link
Owner

@eddmann eddmann commented Nov 13, 2025

Add detailed documentation analyzing the PHP-SDL2 implementation gaps compared to the terminal frontend:

  • Feature-by-feature comparison of CLI vs SDL2 frontends
  • Implementation guide with code examples for missing features
  • Quick reference for file locations and architecture

Key findings:

  • SDL2 is ~60% complete with input/display working
  • Audio output is the critical blocker (not implemented)
  • Missing frontend selection, hotkeys, and OSD features
  • Estimated 6-9 hours to reach MVP, 11-15 hours for feature parity

Add detailed documentation analyzing the PHP-SDL2 implementation gaps compared to the terminal frontend:
- Feature-by-feature comparison of CLI vs SDL2 frontends
- Implementation guide with code examples for missing features
- Quick reference for file locations and architecture

Key findings:
- SDL2 is ~60% complete with input/display working
- Audio output is the critical blocker (not implemented)
- Missing frontend selection, hotkeys, and OSD features
- Estimated 6-9 hours to reach MVP, 11-15 hours for feature parity
Add complete SDL2 audio support to achieve feature parity with CLI frontend:

- Implement SdlAudioSink class with SDL2 audio subsystem integration
- Add real-time audio playback using SDL_QueueAudio
- Support configurable sample rate (default 44100 Hz) and buffer size
- Implement 16-bit signed stereo output with automatic overflow protection
- Add --frontend=cli|sdl command-line option for frontend selection
- Integrate SDL2 audio sink when using SDL frontend with --audio flag
- Update help text with SDL2 frontend documentation
- Add SDL extension detection with helpful error messages

Technical details:
- Sample format: AUDIO_S16LSB (16-bit signed little-endian)
- Channels: 2 (stereo)
- Default buffer: 512 samples (configurable 128-8192)
- Automatic graceful degradation if SDL audio unavailable

The SDL2 frontend now has complete feature parity with CLI for core
emulation functionality (input, display, audio). Remaining work is
UX enhancements (hotkeys, OSD, window management).

Usage:
  php bin/phpboy.php rom.gb --frontend=sdl --audio

Updated documentation to reflect SDL2 production-ready status.
@eddmann eddmann force-pushed the claude/review-php-sdl2-compatibility-01KhnzHo5k6ES4gAQTkSFvwC branch from af1adb2 to f234691 Compare November 13, 2025 22:28
Add PHPStan ignore patterns for SDL2 extension functions and constants
used in SdlAudioSink that are not available at static analysis time:

- Ignore lowercase sdl_* functions (e.g., sdl_queue_audio)
- Ignore AUDIO_* constants (e.g., AUDIO_S16LSB)
- Ignore SDL class static method calls
- Ignore method_exists checks on SDL class

These SDL2 functions/constants are runtime dependencies from the
optional PHP SDL extension and are properly guarded with extension_loaded
checks and error handling in the code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants