From ac98458e0b234e13936a9c2a98a413408d0f08c9 Mon Sep 17 00:00:00 2001 From: SachinVin <26602104+SachinVin@users.noreply.github.com> Date: Sat, 5 Mar 2022 12:38:46 +0530 Subject: [PATCH] audio_core\lle\lle.cpp: Add 16 bit and 32 bit read/write callbacks (#5968) --- src/audio_core/lle/lle.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/audio_core/lle/lle.cpp b/src/audio_core/lle/lle.cpp index 0bb520f03..5786e156c 100644 --- a/src/audio_core/lle/lle.cpp +++ b/src/audio_core/lle/lle.cpp @@ -482,6 +482,22 @@ DspLle::DspLle(Memory::MemorySystem& memory, bool multithread) ahbm.write8 = [&memory](u32 address, u8 value) { *memory.GetFCRAMPointer(address - Memory::FCRAM_PADDR) = value; }; + ahbm.read16 = [&memory](u32 address) -> u16 { + u16 value; + std::memcpy(&value, memory.GetFCRAMPointer(address - Memory::FCRAM_PADDR), sizeof(u16)); + return value; + }; + ahbm.write16 = [&memory](u32 address, u16 value) { + std::memcpy(memory.GetFCRAMPointer(address - Memory::FCRAM_PADDR), &value, sizeof(u16)); + }; + ahbm.read32 = [&memory](u32 address) -> u32 { + u32 value; + std::memcpy(&value, memory.GetFCRAMPointer(address - Memory::FCRAM_PADDR), sizeof(u32)); + return value; + }; + ahbm.write32 = [&memory](u32 address, u32 value) { + std::memcpy(memory.GetFCRAMPointer(address - Memory::FCRAM_PADDR), &value, sizeof(u32)); + }; impl->teakra.SetAHBMCallback(ahbm); impl->teakra.SetAudioCallback( [this](std::array sample) { OutputSample(std::move(sample)); });