diff options
author | RSDuck <RSDuck@users.noreply.github.com> | 2022-08-21 16:40:30 +0200 |
---|---|---|
committer | RSDuck <RSDuck@users.noreply.github.com> | 2022-08-21 16:40:30 +0200 |
commit | f0657e1a9b0827c04e5512f1ab9b6949720eca78 (patch) | |
tree | 749715ad4f4ab0c47630d3fdc94669305e34a03d /src/DSi_DSP.cpp | |
parent | 3ad5f3e22ef647e26882130a62e91e8f8b4216bc (diff) |
basic implementation of SNDExCnt
isn't hooked up to the DSP or microphone though
fixes memory abort in TwilightMenu
Diffstat (limited to 'src/DSi_DSP.cpp')
-rw-r--r-- | src/DSi_DSP.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/DSi_DSP.cpp b/src/DSi_DSP.cpp index c889aff..0525366 100644 --- a/src/DSi_DSP.cpp +++ b/src/DSi_DSP.cpp @@ -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()) |