Skip to content

PSX3DS v0.2.4 — Fix 480i VSync(0) Logo Freeze, FMV MDEC DMA1 Pacing & 3DS HOME->Close Hang

Choose a tag to compare

@codescv codescv released this 11 Nov 03:41

PSX3DS v0.2.4 — Fix 480i Interlaced VSync(0) Freeze, FMV MDEC DMA1 Pacing, PICA200 TexPage Wrap/Readback Stripes, and 3DS HOME -> Close Hang

v0.2.4 fixes real-hardware issues reported on New 3DS XL (SCPH5500.BIN + World Soccer Jikkyou Winning Eleven 3 - Final Ver. SLPM_861.62): freezing on the 480i interlaced logo screen (VSync(0)), FMV MDEC_in_sync timeout stalls, PICA200 hardware-backend right-column texture stripes on tp_x = 960 8bpp pages, and hanging on "Closing software..." when closing the emulator from the 3DS HOME Menu.


English Release Notes

1. Fix 480i Interlaced GPUSTAT Bit 31 / Bit 13 Freeze in Psy-Q VSync(0) (src/gpu/gpu.c, src/core/timers.c)

  • Root Cause: sys->gpu.frame was incremented twice per frame — once in gpu_on_vblank() at scanline 240 and a second time in timers_hblank_cb() at scanline 0 — leaving (gpu.frame & 1) permanently even (0) during active video (!in_vblank) while VBlank cleared bit 31 to 0. Consequently, in 480i interlaced mode (GP1(0x08) bit 22 + bit 19), GPUSTAT bit 31 never toggled, hanging Sony Psy-Q VSync(0) forever after initial logo mode switches (e.g. Winning Eleven 3 around frame 560).
  • Fix: sys->gpu.frame now increments strictly once per frame in gpu_on_vblank(), and gpu_refresh_scanline_bits() latches the new field parity into GPUSTAT bits 13 & 31 before IRQ0 (IRQ_VBLANK) is raised. Also removed duplicate sys->stats.frames++ from the standalone timers_vblank_default_cb fallback.

2. Fix FMV MDEC_in_sync timeout When DecDCTout (DMA1) Is Armed Before DecDCTin (DMA0) (src/core/dma.c, src/periph/mdec.c)

  • Root Cause: Standard Psy-Q FMV pipelines call DecDCTout() (DMA1, SyncMode 1) before DecDCTin() (DMA0). Previously, DMA1 executed immediately against an empty MDEC Data-Out FIFO (writing zeros into slice 0 and stranding the final decoded slice with MDEC_STAT bit 29 Command Busy = 1), causing the next frame's DecDCTinSync(0) to spin out with MDEC_in_sync timeout.
  • Fix: DMA1 (PSX_DMA_CH_MDEC_OUT, SyncMode 1) now stays armed until mdec_dma_out_blocks_ready() reports decoded blocks available, transfers only decoded blocks, and wakes immediately via dma_request_wakeup() when MDEC produces output. MDEC_STAT bit 29 (Command Busy) clears cleanly once decoding finishes and DMA1 is idle.

3. Fix PICA200 citro3d Right-Column Stripes (tp_x = 960 Wrap & Dirty-Cell Readback/Upload Coherence) (src/gpu_hw/gpu_citro3d.c, src/gpu_hw/gpu_texcache.c, src/gpu_hw/gpu_morton.c)

  • Root Cause: On 8bpp texture pages at tp_x = 960 (128 words wide), 960 + 128 = 1088 wrapped onto X = 0..63 (the active framebuffer), triggering hw_sync_to_shadow(960, 0, 128, 256) on every frame and copying back non-dirty cells at X = 960..1023 whose opaque RGBA5551 upload had forced PSX bit 15 (0x8000) to 1 — adding +128 to every odd 8bpp texel column.
  • Fix: Clamped TexPage coherence/invalidation width at X = 1023 (gpu_texpage_coherence_width()), restricted hw_sync_to_shadow to GPU-dirty 16x16 cells only (gpu_morton_readback_cells), replaced bounding-box CPU uploads with exact 8x8 dirty-tile runs (gpu_morton_upload_tiles), and added sync_cells_around_rect() on partial CPU overwrites (gpu_tex_hit_pct improved to 99.8% with zero stripes).

4. Fix 3DS HOME Menu -> "Close" Console Hang (src/gpu_hw/gpu_citro3d.c, src/platform/3ds/threads_3ds.c)

  • Root Cause:
    1. Pressing HOME triggers citro3d's APTHOOK_ONSUSPEND callback, disabling GSP VBlank callbacks and releasing GPU rights to the Home Menu. Tapping Close sends APTCMD_EXIT without APTHOOK_ONRESTORE, so calling C3D_FrameEnd(0) / C3D_FrameSync() unconditionally in hw_destroy() deadlocked forever inside gspWaitForAnyEvent().
    2. spu_core1_worker ran on Core 1 (SysCore, shared with Horizon OS Home Menu/APT/GSP/DSP applets) at main_prio - 1 (0x2F, higher priority than main 0x30), and worker threads were not parked during APT suspend/sleep/exit transitions.
  • Fix:
    • gpu_citro3d registers hw_apt_hook (called before citro3d's own hook) to cleanly flush and C3D_FrameEnd(0) any open frame on APTHOOK_ONSUSPEND, and guards hw_present() / hw_destroy() behind aptIsActive() && !aptShouldClose().
    • spu_core1_worker on Core 1 (SysCore) now runs cooperatively at main_prio + 1 (0x31), and threads_apt_hook parks both Core 1 (SPU) and Core 2 (CD readahead) workers in 10 ms sleeps without touching NDSP, DSP cache, or SDMC across APTHOOK_ONSUSPEND / ONSLEEP / ONEXIT.

中文更新说明 (v0.2.4)

  1. 修复 480i 隔行扫描模式下卡在 Logo 画面的问题(如《实况足球 3 最终版》):
    • 修复了 sys->gpu.frame 在每帧 VBlank 起点(扫描线 240)和扫描线 0 被重复递增两次的 Bug。现在场奇偶计数每帧严格递增一次,且在触发 IRQ_VBLANK 前预先锁存 GPUSTAT 第 13/31 位奇偶场标志,使 Psy-Q VSync(0) 正常翻转退出,顺利通过 480i JFA/Konami Logo 进入片头 FMV 动画与标题菜单。
  2. 修复片头 FMV 视频播放期间 MDEC_in_sync timeout 卡顿:
    • 当游戏按 Psy-Q 惯例先挂载 DecDCTout(DMA1,SyncMode 1)再启动 DecDCTin(DMA0)时,DMA1 现会等待 MDEC 输出 FIFO 产生解码宏块后再由 dma_request_wakeup() 唤醒搬运,彻底消除空读全零切片与 MDEC_in_sync timeout 超时。
  3. 修复 PICA200 硬件渲染器在 tp_x = 960 8bpp 纹理页上的右侧竖条纹花屏:
    • 限制纹理页一致性检测宽度不跨过 X = 1023 回绕至主帧缓冲,将 VRAM 回读严格限定于 GPU 脏 16x16 区块,并将 CPU 上传改为精确 8x8 脏瓦片区间提交,标题画面全部 368 列完整清晰无条纹(纹理缓存命中率提升至 99.8%)。
  4. 修复按下 3DS HOME 键在主界面关闭软件时卡在“正在关闭软件…”的死锁:
    • gpu_citro3d 新增 APTHOOK_ONSUSPEND 钩子在挂起前提交未闭合帧,并在 !aptIsActive() || aptShouldClose() 时跳过 C3D_FrameBegin / C3D_FrameEnd / C3D_FrameSync,避免在失去 GSP 权限后永久阻塞于 gspWaitForAnyEvent()。
    • Core 1(SysCore)上的 SPU 音频线程优先级调整为协作式 main_prio + 1,并在 HOME 挂起/休眠/退出期间自动挂起双核工作线程(不触碰 NDSP / DSP 缓存 / SD 卡),确保退回主界面与关闭游戏秒退不卡死。