PS2 games in the browser: static recompilation to WebAssembly with a native runtime
C++
DMA: a CHCR write to a running channel only stops it
Samir Nurid17433bee363
diff --git a/runtime/src/dmac.cpp b/runtime/src/dmac.cppindex 8a52cb0..70d289c 100644--- a/runtime/src/dmac.cpp+++ b/runtime/src/dmac.cpp@@ -426,12 +426,20 @@ void write(std::uint32_t a, std::uint32_t v) {switch (a - kBase[ch]) {case 0x00: {const bool was = c.chcr & 0x100u;- c.chcr = v;+ if (was) {+ if (!(v & 0x100u)) {+ c.chcr &= ~0x100u;+ c.paused = false;+ if (ch == 1) g_mfifo_waiting = false;+ }+ break;+ }+ c.chcr = (v & 0xFFFFu) | (c.chcr & 0xFFFF0000u);if (!(v & 0x100u)) {c.paused = false;if (ch == 1) g_mfifo_waiting = false;}- if (!was && (v & 0x100u)) start(ch);+ if (v & 0x100u) start(ch);break;}case 0x10: c.madr = v; break;