4 Commits
Author SHA1 Message Date
alexandClaude Sonnet 5 168d6a71bd Fix esp32 wait-timing race, rename wc_api.lib, keyboard: Enter-to-advance
esp32.c: two-phase esp_wait_busy() so a stale non-BUSY status right after
esp_cmd() isn't mistaken for completion (fixed a real TRACK_PLAY/0x88 race
on heavier XM files); added single-phase esp_wait_not_busy() for
esp_send_dma()'s per-chunk wait, which never actually sets BUSY and was
timing out on every chunk under the two-phase version.

vgm_wc_api.lib renamed to wc_api.lib (build.bat updated to match).

Keyboard: tried replacing wc_key_esc/pgup/pgdn/space with a raw PS/2-FIFO
reader (matching how VGMPLAY.WMF's own player reads keys) so Enter could
also advance to the next file. Reverted after two confirmed hardware
regressions (esp32 transfers failing with ESP_ERR_INV_XM, and the keyboard
going unresponsive once WC's own PS/2 scanning was disabled to stop it
competing with the raw reads) - VGMPLAY's approach relies on a full custom
interrupt handler xmplay has no equivalent need for. Back to the simple
wc_key_*() wrappers, plus wc_key_enter() so Enter now advances too, and
wc_key_wait_release() (called after wc_gedpl()) to debounce the Enter/F3
that launched the plugin itself.

Also: About window now centers dynamically for all three WC text modes
(90x36/80x25/80x30) instead of a fixed position, and matches the main
window's color scheme.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-07 12:40:36 +03:00
alex a279a0eed3 Update sources, rebuild artifacts, add .gitignore 2026-08-31 21:26:25 +03:00
alexandClaude Sonnet 5 ee64fb85a9 Fix esp32 detection, add colored caption, live stats, single-loop playback
- Fix state_esp init bug: crt0.s never runs GSINIT and hex2bin fills
  unbacked memory with 0xFF (not 0), so a plain zero-init global always
  read 0xFF on load; give it a real 0xFF sentinel initializer instead.
- Vendor demyanenko-d/VGMPLAY.WMF's wc_api library (SDCC 4.6.0 +
  --sdcccall 1) instead of hand-rolled PRSRW/PRIAT wrappers, which
  corrupted esp32 file loading in three different shapes; colored "File:"
  caption now works.
- Trim shared-file footprint: vendor only the esp32.c functions actually
  used, drop unused sdklib.h/sdk.lib linkage.
- Re-enable periodic live stats (Pattern/Row/BPM/Time/progress bar).
- Limit playback to one loop via TRACK_SET_PARAMS/MAX_LOOP_COUNT, and
  auto-advance to the next file when a track finishes on its own
  (detected via a PLAYING->STOPPED ESP_REG_TRACK_STATUS transition).
- Pin the Z80 clock to 14MHz for the whole plugin lifetime so esp32 SPI
  wait-loop timeouts (raw iteration counts, not real time) don't depend
  on whatever turbo setting was active before the plugin started.
- Pad TRACK_INIT's timeout well past the firmware's 5s song-length
  measurement cap (XM_MEASURE_MAX_US).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-30 21:40:24 +03:00
alex 6163d0c8ca Initial commit 2026-08-30 19:47:39 +03:00