basic implementation of SNDExCnt

isn't hooked up to the DSP or microphone though
fixes memory abort in TwilightMenu
This commit is contained in:
RSDuck
2022-08-21 16:40:30 +02:00
parent 3ad5f3e22e
commit f0657e1a9b
3 changed files with 56 additions and 6 deletions

View File

@ -27,6 +27,9 @@
namespace DSi_DSP
{
// not sure whether to not rather put it somewhere else
u16 SNDExCnt;
Teakra::Teakra* TeakraCore;
bool SCFG_RST;
@ -151,6 +154,8 @@ void Reset()
TeakraCore->Reset();
NDS::CancelEvent(NDS::Event_DSi_DSP);
SNDExCnt = 0;
}
bool IsRstReleased()
@ -548,6 +553,21 @@ void Write32(u32 addr, u32 val)
Write16(addr, val & 0xFFFF);
}
void WriteSNDExCnt(u16 val)
{
// it can be written even in NDS mode
// mic frequency can only be changed if it was disabled
// before the write
if (SNDExCnt & 0x8000)
{
val &= ~0x2000;
val |= SNDExCnt & 0x2000;
}
SNDExCnt = val & 0xE00F;
}
void Run(u32 cycles)
{
if (!IsDSPCoreEnabled())