U-DESKTOP-SPFP6AQ\twistedtechre b5b43ad2be core: revert LQ dispatch deduplication from pass 6 (audio regression)
Pass 6 (commit 9f6b84c) optimized SetSoundVariables() in LQ mode by
pointing DoSQ2, DoNoise, and DoPCM at Dummyfunc instead of redundantly
calling RDoSQLQ / RDoTriangleNoisePCMLQ. The reasoning at the time:
those workers guard with `if (end <= start) return;` so re-entry
within one FlushEmulateSound is a no-op and the second/third/fourth
calls are wasted dispatch overhead.

That reasoning was wrong. The Do* hooks are also called from two
mid-frame paths:

  * Write_PSG (sound.c:189) on every APU register write, BEFORE the
    register update, to flush pending samples up to the current
    SOUNDTS using the pre-write register state.
  * FCEU_SoundCPUHook (sound.c:493) on every DMC bit advance, to
    flush samples up to the current SOUNDTS so the new PCM byte gets
    rendered against the correct prior state.

Between any two such calls, sound_timestamp has grown with each CPU
instruction, so each Do* call IS legitimately doing work - the early-
return guard only fires within a single FlushEmulateSound batch, NOT
across calls separated by CPU cycles.

Stubbing DoSQ2 / DoNoise / DoPCM to Dummyfunc therefore skipped all
the mid-frame flushes triggered by writes to $4004-$4007 (SQ2
registers), $400C-$400F (noise registers), and $4010-$4013 (DMC
registers). For any game that writes to multiple APU registers in
sequence (essentially all of them), the audio output diverged from
the pre-pass-6 baseline.

Bisect: built three test ROMs covering "APU disabled", "channels
enabled with steady tone, no register writes after init", and "all
channels active with continuous register pumping". The
register-writing scenarios diverged starting at the first
post-initialization register write; the steady-tone scenario
diverged starting at the next DMC bit advance after init. Reverting
just the LQ dispatch dedup restored bit-identical audio for all
three scenarios.

Fix: restore DoSQ2 -> RDoSQLQ, DoNoise -> RDoTriangleNoisePCMLQ,
DoPCM -> RDoTriangleNoisePCMLQ. Add a comment explaining why this
optimization is incorrect, so the same mistake is not repeated.

The other pass 6 changes remain in place and are verified safe:

  * SexyFilter_Reset() called from FCEUSND_Power - filter state
    determinism fix.
  * sexyfilter2_acc lifted to file scope, added to FCEUSND_STATEINFO
    as "FAC3" - savestate completeness fix.
  * WaveHi memset bound tightened from sizeof(WaveHi) - left*4 to
    (SOUNDTS - left) * sizeof(uint32_t) - HQ-mode optimization.
  * RDoSQLQ silent-channels branch loop body removed - totalout is
    provably 0 in that branch, so the loop was a true no-op for
    ~30000 NES cycles per silent frame.
  * stereo_filter_apply_delay element-by-element loop replaced with
    memcpy.
  * filter.c #ifdef moo / #if 0 dead blocks and unused <math.h>
    include removed.

Verified bit-identical to pre-pass-6 baseline for all three test
ROMs. Performance impact of the cleanup pass (with the LQ dedup
correctly reverted, attributed to the actually-correct
optimizations) is ~9% per-frame reduction across silent / idle /
active scenarios. Pass 6's previously-reported ~25% speedup on the
active scenario was inflated by the buggy optimization skipping
legitimate work.

Build clean under -std=gnu11 -Wno-write-strings -Wsign-compare
-Wundef -Wmissing-prototypes; zero errors, zero warnings.
audit_determinism.py clean.
2026-05-04 05:32:28 +02:00
2024-09-23 05:55:21 -07:00
2023-01-02 19:47:36 +01:00
2026-04-02 10:14:04 +01:00
Fix
2017-12-21 20:40:28 +09:00
2014-12-23 09:50:29 +01:00
2015-08-06 13:28:43 +02:00
2025-09-03 16:20:50 +02:00
2019-06-28 23:44:06 +02:00

Build Status Build status

FCE Ultra mappers modified

FCEU "mappers modified" is an unofficial build of FCEU Ultra by CaH4e3, which supports a lot of new mappers including some obscure mappers such as one for unlicensed NES ROM's.

Sequential targets Light Guns support added

Support for Sequential targets Light Guns has been added. "Gun Aux A" serves as light sensor logic input.

Description
Pinned internal source mirror of libretro/libretro-fceumm for Supergame releases
Readme 4.3 MiB
Languages
C 97.7%
Python 2%
C++ 0.2%