This is probably a really roundabout solution, but how about creating a save state when it looks like you're stuck in the NULL loop?
The DSTwo may be in an inconsistent state that doesn't allow it to do that.
When ds2_getAudiobuff() returns NULL after the 2nd retry of sound_update, the following things happen:
* the serial line continues outputting properly;
* the game continues running, not accepting any input from the B, A, Start, Select, L, R, X and Y DS buttons (not sure about the Touch Screen and d-pad, see below);
* images and sound output, which are driven by interrupts and DMA, are forcibly stopped;
* the recompiler continues running, and on the serial line, I can see "Clearing IWRAM metadata: Last tag reached" every so often;
* touching the Touch Screen stops the game and enters the menu, which does not display -- thereafter, any input to exit the menu is ignored (because at least the input from the B key is ignored).
My guesses are as follows:
* Some kind of race condition occurs on the MIPS when there's a transition between "there is at least one buffer of audio left to send" and "we have run out of sound data to be sent" -- which manifests when the FPS needs to drop -- and the sound channel disables all the rest;
* The interrupt handler for the DSTwo-to-DS transfer on the MIPS is not re-entrant, and entering it twice disables interrupts;
* Some kind of race condition occurs on the DS when there's a transition between "there is no audio for now" and "we are preparing to receive audio".
The red ones would disallow writing to the SD card, which is an MMC interrupt on the MIPS.
The following cannot happen:
* The interrupt handler for the DSTwo-to-DS transfer on the DS is not re-entrant, and entering it twice disables interrupts. This cannot happen because the Touch Screen works to enter the menu (exactly once), and it's an interrupt.