16 Commits
Author SHA1 Message Date
Fiskbit 8530ad3198 NES: Improve DMC sample duplication emulation. (#80)
On late-G and H CPUs, starting a 1-byte sample just before the end of a DMC period can cause the sample to be fetched and played twice. This change fixes 2 issues related to this.

First, new research found that this bug is because there is normally at least a 1-APU cycle gap between the end of one DMC DMA and the start of the next DMC DMA on earlier CPUs, but these later CPUs remove that gap, allowing the aborted DMA behavior to occur sooner such that it can't be aborted.

But this means it actually affects any sample that is started at the end of a DMC period, not just ones that trigger the extra DMA. Mesen was previously only doing this in the case of 1-byte non-looping samples. This change fixes this issue. This was validated with AccuracyCoin's Implicit DMA Abort test and with dmc_dma_stop_test_v3 test F.

Second, when there are two DMC DMA's back to back while reading a joypad register, both of them should cause an extra clock of the joypads when using NES behavior (unless suppressed by the APU register activation bug). However, we were only seeing extra clocks with HVC-001 behavior (which is handled on every DMA cycle always) because Mesen only runs its halt cycle logic for the first of the two DMAs. This change makes ProcessPendingDma call itself in the case where we handle DMC DMA back to back so it can do this extra joypad clock if need be.

This second change was validated with dmc_dma_start_test_v2 test C, dmc_dma_implicit_stop_level_test, and a variant of apu_register_activation_test.
2026-05-08 16:39:11 -07:00
SourMesen e391fd8f9a Code: Add auto-formatting rules for C++ (clang-format) and enforce in CI via "clang-format" and "dotnet format" (#78)
* Code: Add auto-formatting rules for C++ projects (clang-format) and enforce code style via "clang-format" and "dotnet format"

* fix ui format warnings
2026-04-30 06:03:55 -07:00
Sour 043e89304d NES: Fixed edge case in DMC start condition that could cause DMA to start 1 or 2 cycles too early in rare scenarios 2025-06-11 19:29:45 +09:00
Sour fef5573bda NES: Added option to reverse DPCM bit playback order
Improves DPCM quality for some specific games that have their DPCM data reversed
2025-03-23 20:52:09 +09:00
Sour 64933699a8 NES: Reset newly added internal flags on console reset 2024-09-29 20:19:43 +09:00
Sour ab8f9f60da NES: Implemented DMC glitch that causes an additional DMA to run fully or partially, depending the 4015 write's timing 2024-09-28 16:44:34 +09:00
Sour 484b61e395 NES: Implemented DMA bug when disabling the DMC channel with a 4015 write 2024-09-28 09:48:35 +09:00
Sour d91e5cecb4 Debugger: Register Viewer - NES - Added DMC next sample addess value 2023-02-28 23:43:29 -05:00
Sour c4b6312c0a Refactoring - Added missing folder names in includes 2022-09-08 22:04:18 -04:00
Sour 152abf690b Rename stdafx.h to pch.h 2022-09-08 21:29:52 -04:00
Sour b456170551 Save states: Serializer rework/rewrite 2022-07-20 00:40:32 -04:00
Sour 768a3f6e17 NSF support (WIP) 2021-04-30 20:41:26 -04:00
Sour 32d5221c2a Refactor NES APU core 2021-04-28 20:59:58 -04:00
Sour c2df0ef553 Console region refactoring/changes 2021-04-27 23:30:00 -04:00
Sour 0479d6f90a VS system/dualsystem (missing palette and proper audio/video option support) 2021-04-25 14:12:10 -04:00
Sour b79f726b34 Reorganize files (NES) 2021-04-09 19:01:41 -04:00