From 4f23f963ef8e809d70e2dd8cdc16a7225faa8744 Mon Sep 17 00:00:00 2001 From: Kurausukun Date: Sun, 23 May 2021 18:18:30 -0400 Subject: [PATCH] small typo and formatting fixes --- Implementing-ipatix's-High-Quality-Audio-Mixer.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Implementing-ipatix's-High-Quality-Audio-Mixer.md b/Implementing-ipatix's-High-Quality-Audio-Mixer.md index f87d6c2..a062a12 100644 --- a/Implementing-ipatix's-High-Quality-Audio-Mixer.md +++ b/Implementing-ipatix's-High-Quality-Audio-Mixer.md @@ -93,16 +93,14 @@ Note that this section only applies if you have both increased the engine rate i ``` Now all that we need to do is replace the definitions of the buffers. This must be done in the following two locations: 1. In [constants/m4a_constants.inc](https://github.com/pret/pokeemerald/blob/master/constants/m4a_constants.inc), `PCM_DMA_BUF_SIZE` is set on line 3; change it there. -2. In [include/gba/m4a_internal.h](https://github.com/pret/pokeemerald/blob/master/include/gba/m4a_internal.h), PCM_DMA_BUF_SIZE is set on line 169; change it there. +2. In [include/gba/m4a_internal.h](https://github.com/pret/pokeemerald/blob/master/include/gba/m4a_internal.h), `PCM_DMA_BUF_SIZE` is set on line 169; change it there. ### Making DMA transfers atomic Because the new sound engine uses DMA3 (by default, see Mixer Config below), which the game does not expect, we have to make some adjustments to prevent game crashes. The reason we have to do this is that pokeemerald writes the DMA registers value by value which leaves a very small chance for interrupts inbetween those register writes. If we interrupt those writes before the DMA transfer is enabled (which is done by the last write) we will corrupt the register state and once the interrupt returns, a DMA transfer is initiated with the wrong values. -We can fix this very easily by using the `STMIA` instruction for DMA register writes, which cannot be interrupted. If we do that we can make sure the registers are always in a well defined state. Either a transfer is initialized and comleted or it is has not begun yet. See the following patch which makes the game write to DMA by using `STMIA`: +We can fix this very easily by using the `STMIA` instruction for DMA register writes, which cannot be interrupted. If we do that we can make sure the registers are always in a well defined state. Either a transfer is initialized and completed or it is has not begun yet. See the following patch which makes the game write to DMA by using `STMIA` in [include/gba/macro.h](https://github.com/pret/pokeemerald/blob/master/include/gba/macro.h): ```diff ---- pokeemerald/include/gba/macro.h -+++ pokeemerald/include/gba/macro.h #define DmaSet(dmaNum, src, dest, control) \ { \ vu32 *dmaRegs = (vu32 *)REG_ADDR_DMA##dmaNum; \