mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-30 21:30:04 +00:00 
			
		
		
		
	Merge pull request #3996 from NarcolepticK/dsp-remove-weakptr
service/dsp: Clean up global state
This commit is contained in:
		
						commit
						14bc20fc8d
					
				
					 5 changed files with 40 additions and 24 deletions
				
			
		|  | @ -21,8 +21,6 @@ enum class DspPipe; | |||
| namespace Service { | ||||
| namespace DSP { | ||||
| 
 | ||||
| static std::weak_ptr<DSP_DSP> dsp_dsp; | ||||
| 
 | ||||
| void DSP_DSP::RecvData(Kernel::HLERequestContext& ctx) { | ||||
|     IPC::RequestParser rp(ctx, 0x01, 1, 0); | ||||
|     const u32 register_number = rp.Pop<u32>(); | ||||
|  | @ -313,6 +311,10 @@ void DSP_DSP::ForceHeadphoneOut(Kernel::HLERequestContext& ctx) { | |||
|     LOG_DEBUG(Service_DSP, "(STUBBED) called, force={}", force); | ||||
| } | ||||
| 
 | ||||
| // DSP Interrupts:
 | ||||
| // The audio-pipe interrupt occurs every frame tick. Userland programs normally have a thread
 | ||||
| // that's waiting for an interrupt event. Immediately after this interrupt event, userland
 | ||||
| // normally updates the state in the next region and increments the relevant frame counter by two.
 | ||||
| void DSP_DSP::SignalInterrupt(InterruptType type, DspPipe pipe) { | ||||
|     LOG_DEBUG(Service_DSP, "called, type={}, pipe={}", static_cast<u32>(type), | ||||
|               static_cast<u32>(pipe)); | ||||
|  | @ -398,20 +400,10 @@ DSP_DSP::~DSP_DSP() { | |||
|     pipes = {}; | ||||
| } | ||||
| 
 | ||||
| // DSP Interrupts:
 | ||||
| // The audio-pipe interrupt occurs every frame tick. Userland programs normally have a thread
 | ||||
| // that's waiting for an interrupt event. Immediately after this interrupt event, userland
 | ||||
| // normally updates the state in the next region and increments the relevant frame counter by two.
 | ||||
| void SignalPipeInterrupt(DspPipe pipe) { | ||||
|     auto dsp = dsp_dsp.lock(); | ||||
|     ASSERT(dsp != nullptr); | ||||
|     return dsp->SignalInterrupt(InterruptType::Pipe, pipe); | ||||
| } | ||||
| 
 | ||||
| void InstallInterfaces(SM::ServiceManager& service_manager) { | ||||
|     auto dsp = std::make_shared<DSP_DSP>(); | ||||
|     dsp->InstallAsService(service_manager); | ||||
|     dsp_dsp = dsp; | ||||
|     Core::DSP().SetServiceToInterrupt(std::move(dsp)); | ||||
| } | ||||
| 
 | ||||
| } // namespace DSP
 | ||||
|  |  | |||
|  | @ -251,12 +251,6 @@ private: | |||
|     std::array<Kernel::SharedPtr<Kernel::Event>, AudioCore::num_dsp_pipe> pipes = {{}}; | ||||
| }; | ||||
| 
 | ||||
| /**
 | ||||
|  * Signal a specific DSP related interrupt of type == InterruptType::Pipe, pipe == pipe. | ||||
|  * @param pipe The DSP pipe for which to signal an interrupt for. | ||||
|  */ | ||||
| void SignalPipeInterrupt(AudioCore::DspPipe pipe); | ||||
| 
 | ||||
| void InstallInterfaces(SM::ServiceManager& service_manager); | ||||
| 
 | ||||
| } // namespace DSP
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue