Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #11634 from AdmiralCurtiss/dsp-class
HW/DSP: Refactor to class.
  • Loading branch information
lioncash committed Mar 10, 2023
2 parents 40ff9b2 + 929222f commit 3ec32c5
Show file tree
Hide file tree
Showing 19 changed files with 406 additions and 398 deletions.
5 changes: 3 additions & 2 deletions Source/Core/Core/Core.cpp
Expand Up @@ -568,7 +568,8 @@ static void EmuThread(std::unique_ptr<BootParameters> boot, WindowSystemInfo wsi
else
Config::SetBaseOrCurrent(Config::MAIN_DSP_THREAD, cpu_info.num_cores > 2);

if (!DSP::GetDSPEmulator()->Initialize(core_parameter.bWii, Config::Get(Config::MAIN_DSP_THREAD)))
if (!system.GetDSP().GetDSPEmulator()->Initialize(core_parameter.bWii,
Config::Get(Config::MAIN_DSP_THREAD)))
{
PanicAlertFmt("Failed to initialize DSP emulation!");
return;
Expand Down Expand Up @@ -785,7 +786,7 @@ static bool PauseAndLock(Core::System& system, bool do_lock, bool unpause_on_unl
ExpansionInterface::PauseAndLock(do_lock, false);

// audio has to come after CPU, because CPU thread can wait for audio thread (m_throttle).
DSP::GetDSPEmulator()->PauseAndLock(do_lock, false);
system.GetDSP().GetDSPEmulator()->PauseAndLock(do_lock, false);

// video has to come after CPU, because CPU thread can wait for video thread
// (s_efbAccessRequested).
Expand Down
7 changes: 5 additions & 2 deletions Source/Core/Core/Debugger/PPCDebugInterface.cpp
Expand Up @@ -325,8 +325,11 @@ u32 PPCDebugInterface::ReadExtraMemory(const Core::CPUThreadGuard& guard, int me
case 0:
return PowerPC::HostRead_U32(guard, address);
case 1:
return (DSP::ReadARAM(address) << 24) | (DSP::ReadARAM(address + 1) << 16) |
(DSP::ReadARAM(address + 2) << 8) | (DSP::ReadARAM(address + 3));
{
auto& dsp = Core::System::GetInstance().GetDSP();
return (dsp.ReadARAM(address) << 24) | (dsp.ReadARAM(address + 1) << 16) |
(dsp.ReadARAM(address + 2) << 8) | (dsp.ReadARAM(address + 3));
}
default:
return 0;
}
Expand Down
11 changes: 7 additions & 4 deletions Source/Core/Core/HW/AddressSpace.cpp
Expand Up @@ -212,19 +212,22 @@ struct AuxiliaryAddressSpaceAccessors : Accessors
}
u8 ReadU8(const Core::CPUThreadGuard& guard, u32 address) const override
{
const u8* base = DSP::GetARAMPtr();
const u8* base = Core::System::GetInstance().GetDSP().GetARAMPtr();
return base[address];
}

void WriteU8(const Core::CPUThreadGuard& guard, u32 address, u8 value) override
{
u8* base = DSP::GetARAMPtr();
u8* base = Core::System::GetInstance().GetDSP().GetARAMPtr();
base[address] = value;
}

iterator begin() const override { return DSP::GetARAMPtr(); }
iterator begin() const override { return Core::System::GetInstance().GetDSP().GetARAMPtr(); }

iterator end() const override { return DSP::GetARAMPtr() + GetSize(); }
iterator end() const override
{
return Core::System::GetInstance().GetDSP().GetARAMPtr() + GetSize();
}

std::optional<u32> Search(const Core::CPUThreadGuard& guard, u32 haystack_offset,
const u8* needle_start, std::size_t needle_size,
Expand Down

0 comments on commit 3ec32c5

Please sign in to comment.