Skip to content

PSX3DS v0.2.7 — Real-3DS NDSP Hardware Audio Fix & Winning Eleven 4 Anti-Modchip Fix

Choose a tag to compare

@codescv codescv released this 11 Nov 09:58
· 4 commits to main since this release

PSX3DS v0.2.7 — Real-3DS NDSP Hardware Audio Fix (ndspChnWaveBufClear Stop-Race Re-Arm, Core 0 Exclusive WaveBuf Owner & svcFlushProcessDataCache, Async SPU Readback Coherency) & Winning Eleven 4 Anti-Modchip Fix

v0.2.7 resolves the remaining real New 3DS hardware missing-audio issue reported on v0.2.6 ("1. 还是没声音", while "帧数没问题" confirmed the 60.0 FPS pacer works cleanly on real hardware) and fixes the anti-modchip lockout in World Soccer Jikkyou Winning Eleven 4 (Japan) (SLPM_862.91), verified across The King of Fighters '97, Winning Eleven 3 Final Ver., Winning Eleven 4, and Winning Eleven 2002.


English Release Notes

1. Real-3DS Hardware Audio Fix (src/platform/3ds/audio_ndsp.c, src/platform/3ds/threads_3ds.c, src/platform/3ds/main_3ds.c, src/periph/spu.c)

  • libctru ndspiReadChnState / ndspiUpdateChn Stop-Race Fix (ndspChnWaveBufClear Re-Arm & Zero Menu Dummy Buffers):
    • Root Cause: ELF disassembly of libctru's ndspiReadChnState (0x001ccf88..0x001cd07c) revealed that when the final wavebuf in NDSP finishes (wavebuf_seq == 0, flags == 0x0100), libctru sets chn->wavebuf_queued_count = 0 while leaving chn->playing = 1. Queuing dummy silence buffers in the ROM menu (or draining during BIOS boot) and later calling ndspChnWaveBufAdd without ndspChnWaveBufClear caused ndspiUpdateChn (dirty_playing == 0) to mark wavebufs NDSP_WBUF_PLAYING without restarting the stopped DSP hardware channel or incrementing chn->sync_count, deadlocking g_wbufs in PLAYING on a stopped DSP channel forever.
    • Fix: ctr_audio_init no longer queues silence buffers in the ROM menu; ctr_audio_bind_system resets the channel cleanly on every game boot; and whenever NDSP drains (active_wbufs == 0) or triggers the 150 ms / 35 ms-stopped stall watchdog, ndspChnWaveBufClear(CTR_NDSP_CH) is called before pre-priming 2 x 735 frames (33.3 ms) to bump chn->sync_count and cleanly restart the DSP channel. When down to the final active wavebuf (active_wbufs <= 1), partial frames smoothly decay toward 0 instead of letting the DSP channel stop mid-stream.
  • Core 1 Render / Core 0 NDSP Ownership Split & Kernel11 svcFlushProcessDataCache:
    • Root Cause: DSP_FlushDataCache invokes svcSendSyncRequest(dspHandle) without a lock, racing ndspThreadMain (priority 0x18 on Core 0) on every 5 ms DSP interrupt, and calling it on Core 1 could not clean Core 0's private 16 KiB ARM11 L1 D-cache.
    • Fix: Core 1 (spu_core1_worker) now exclusively calls ctr_audio_render_core1(sys) (rendering queued SpuCmd batches into sys->spu.out_ring without touching g_linear_pcm or ndsp*). Core 0 exclusively owns wavebuf refill and submission (ctr_audio_step_core1 / ctr_audio_pump_core0, pumped every frame and every <= 4 ms slice inside pacer_wait), flushing wavebuf PCM directly from Core 0's L1/L2 cache to FCRAM via Kernel11 svcFlushProcessDataCache(CUR_PROCESS_HANDLE, ...) + GSPGPU_FlushDataCache.
  • Core 0 / Core 1 Async SPU Register Readback Coherency (src/periph/spu.c):
    • Made all spu->endx updates/reads atomic across Core 0 and Core 1, updated Core-0-readable voice shadow state (start_addr, repeat_addr, adsr_vol, and KON clearing endx + zeroing adsr_vol) immediately on MMIO write before cmd_ring drain, and prevented Core 1 cmd_ring replay (spu_apply_queued_reg16) from overwriting newer Core 0 spu->regs[] mirrors. Covered by test_spu_async_readback_coherency.
  • Live Audio Diagnostics on 2:HUD & 4:LOG (src/platform/3ds/ui_bottom.c):
    • 2:HUD now displays live wavebuf submission/in-flight counts and PCM peak amplitude (SPU:C1 NDSP:OK WB:<sub/act> Pk:<peak>), and 4:LOG highlights [audio_ndsp] activation lines in green (COL_OK).

2. Winning Eleven 4 (SLPM_862.91) Anti-Modchip Lockout Fix (src/periph/cdrom.c)

  • Root Cause: At boot (LBA ~52875..53125), Winning Eleven 4 starts muted CD-DA playback, resets SCEx counters (0x19 0x04), and queries GetSCExCounters (0x19 0x05). Returning { stat, 0x01, 0x01 } outside the Lead-In (LBA < 150) mimicked an old non-stealth modchip continuously injecting SCEx strings and triggered "強制終了しました。本体が改造されているおそれがあります。".
  • Fix: CDL_TEST 0x05 now returns { stat, 0x01, 0x01 } only when idle in the Lead-In (cur_lba < 150 and not playing/reading), and { stat, 0x00, 0x00 } whenever playing, reading, or cur_lba >= 150. Covered by test_cdrom_scex_counters.

中文更新说明 (v0.2.7)

  1. 彻底修复 New 3DS 实机无声音问题(libctru NDSP 停止态死锁与跨核缓存一致性):
    • 修复 libctru NDSP 通道耗尽后无法重启的固件交互 Bug:反汇编 psx3ds.elf 中 libctru 的 ndspiReadChnState / ndspiUpdateChn 发现,当最后一个音频缓冲区播放完毕时,libctru 将队列计数清零但保留 chn->playing = 1;此前在 ROM 菜单预先入队的静音缓冲在 67 ms 内耗尽后,后续 ndspChnWaveBufAdd 未先调用 ndspChnWaveBufClear 重置同步计数与播放标志,导致新缓冲永久卡在已停止的 DSP 硬件通道上静音死锁。现移除菜单空转静音缓冲,每次启动游戏及缓冲重充前均通过 ndspChnWaveBufClear 重新武装通道,并加入 150 ms / 35 ms 停滞看门狗与尾帧平滑衰减保护。
    • Core 1 渲染 / Core 0 提交职责分离与 svcFlushProcessDataCache 直刷:Core 1 线程仅负责异步渲染 SPU 采样至 out_ring;所有 NDSP 缓冲区填充、Kernel11 svcFlushProcessDataCache(零 dspHandle IPC 竞争、直刷 Core 0 私有 16 KiB L1 D-Cache 至 FCRAM)及 ndspChnWaveBufAdd 均由 Core 0 独占执行(含 pacer_wait 帧限速休眠期间每 <= 4 ms 切片自动泵送)。
    • 异步 SPU 寄存器回读一致性与 HUD 实时音频监控:原子化 ENDX 状态并在 Core 0 写入 KON / repeat_addr / adsr_vol 时即时同步可读镜像;下屏 2:HUD 新增 SPU:C1 NDSP:OK WB:<已提交/活跃> Pk:<峰值> 实时音频指标,4:LOG 高亮显示 [audio_ndsp] audio active 日志。
  2. 修复《实况足球 4》(Winning Eleven 4, SLPM_862.91) 反改机检测锁死:
    • 修正 CD-ROM Test 0x19 0x05 (GetSCExCounters):仅在光头静止于导入区(LBA < 150)时返回 0x01, 0x01;在数据/音轨区(LBA >= 150)或播放 CD-DA / 读取数据时返回真机一致的 0x00, 0x00,顺利通过反改机校验进入 JOC 授权画面、片头动画与标题界面。
  3. 多游戏实测通过:《拳皇 '97》(SLPM_860.84)、《实况足球 3 最终版》(SLPM_861.62)、《实况足球 4》(SLPM_862.91)、《实况足球 2002》(SLPM_870.56) 均验证正常启动、音频输出饱满且帧率稳定锁定 60.0 FPS。