DSP_DSP: use member system instead of global instance

This commit is contained in:
Weiyi Wang 2019-02-03 21:33:20 -05:00
parent 6ce58248b0
commit ea496507d5
4 changed files with 15 additions and 2 deletions

View File

@ -198,6 +198,8 @@ System::ResultStatus System::Init(EmuWindow& emu_window, u32 system_mode) {
dsp_core = std::make_unique<AudioCore::DspHle>(*memory); dsp_core = std::make_unique<AudioCore::DspHle>(*memory);
} }
memory->SetDSP(*dsp_core);
dsp_core->SetSink(Settings::values.sink_id, Settings::values.audio_device_id); dsp_core->SetSink(Settings::values.sink_id, Settings::values.audio_device_id);
dsp_core->EnableStretching(Settings::values.enable_audio_stretching); dsp_core->EnableStretching(Settings::values.enable_audio_stretching);

View File

@ -394,7 +394,7 @@ void InstallInterfaces(Core::System& system) {
auto& service_manager = system.ServiceManager(); auto& service_manager = system.ServiceManager();
auto dsp = std::make_shared<DSP_DSP>(system); auto dsp = std::make_shared<DSP_DSP>(system);
dsp->InstallAsService(service_manager); dsp->InstallAsService(service_manager);
Core::DSP().SetServiceToInterrupt(std::move(dsp)); system.DSP().SetServiceToInterrupt(std::move(dsp));
} }
} // namespace Service::DSP } // namespace Service::DSP

View File

@ -67,6 +67,7 @@ public:
std::vector<PageTable*> page_table_list; std::vector<PageTable*> page_table_list;
ARM_Interface* cpu = nullptr; ARM_Interface* cpu = nullptr;
AudioCore::DspInterface* dsp = nullptr;
}; };
MemorySystem::MemorySystem() : impl(std::make_unique<Impl>()) {} MemorySystem::MemorySystem() : impl(std::make_unique<Impl>()) {}
@ -325,7 +326,7 @@ u8* MemorySystem::GetPhysicalPointer(PAddr address) {
target_pointer = impl->vram.get() + offset_into_region; target_pointer = impl->vram.get() + offset_into_region;
break; break;
case DSP_RAM_PADDR: case DSP_RAM_PADDR:
target_pointer = Core::DSP().GetDspMemory().data() + offset_into_region; target_pointer = impl->dsp->GetDspMemory().data() + offset_into_region;
break; break;
case FCRAM_PADDR: case FCRAM_PADDR:
target_pointer = impl->fcram.get() + offset_into_region; target_pointer = impl->fcram.get() + offset_into_region;
@ -808,4 +809,8 @@ u8* MemorySystem::GetFCRAMPointer(u32 offset) {
return impl->fcram.get() + offset; return impl->fcram.get() + offset;
} }
void MemorySystem::SetDSP(AudioCore::DspInterface& dsp) {
impl->dsp = &dsp;
}
} // namespace Memory } // namespace Memory

View File

@ -18,6 +18,10 @@ namespace Kernel {
class Process; class Process;
} }
namespace AudioCore {
class DspInterface;
}
namespace Memory { namespace Memory {
// Are defined in a system header // Are defined in a system header
@ -292,6 +296,8 @@ public:
/// Unregisters page table for rasterizer cache marking /// Unregisters page table for rasterizer cache marking
void UnregisterPageTable(PageTable* page_table); void UnregisterPageTable(PageTable* page_table);
void SetDSP(AudioCore::DspInterface& dsp);
private: private:
template <typename T> template <typename T>
T Read(const VAddr vaddr); T Read(const VAddr vaddr);