diff --git a/src/audio_core/dsp_interface.h b/src/audio_core/dsp_interface.h index b1188ab114..f44c77534a 100644 --- a/src/audio_core/dsp_interface.h +++ b/src/audio_core/dsp_interface.h @@ -40,6 +40,13 @@ public: */ virtual u16 RecvData(u32 register_number) = 0; + /** + * Checks whether data is ready in one of three DSP registers + * @param register_number the index of the register to check + * @returns true if data is ready + */ + virtual bool RecvDataIsReady(u32 register_number) const = 0; + /** * Reads `length` bytes from the DSP pipe identified with `pipe_number`. * @note Can read up to the maximum value of a u16 in bytes (65,535). diff --git a/src/audio_core/hle/hle.cpp b/src/audio_core/hle/hle.cpp index eaf5c8c273..3b3d03d55d 100644 --- a/src/audio_core/hle/hle.cpp +++ b/src/audio_core/hle/hle.cpp @@ -30,6 +30,7 @@ public: DspState GetDspState() const; u16 RecvData(u32 register_number); + bool RecvDataIsReady(u32 register_number) const; std::vector PipeRead(DspPipe pipe_number, u32 length); std::size_t GetPipeReadableSize(DspPipe pipe_number) const; void PipeWrite(DspPipe pipe_number, const std::vector& buffer); @@ -112,6 +113,11 @@ u16 DspHle::Impl::RecvData(u32 register_number) { } } +bool DspHle::Impl::RecvDataIsReady(u32 register_number) const { + ASSERT_MSG(register_number == 0, "Unknown register_number {}", register_number); + return true; +} + std::vector DspHle::Impl::PipeRead(DspPipe pipe_number, u32 length) { const std::size_t pipe_index = static_cast(pipe_number); @@ -365,6 +371,10 @@ u16 DspHle::RecvData(u32 register_number) { return impl->RecvData(register_number); } +bool DspHle::RecvDataIsReady(u32 register_number) const { + return impl->RecvDataIsReady(register_number); +} + std::vector DspHle::PipeRead(DspPipe pipe_number, u32 length) { return impl->PipeRead(pipe_number, length); } diff --git a/src/audio_core/hle/hle.h b/src/audio_core/hle/hle.h index cc225b3d52..8db78cf53a 100644 --- a/src/audio_core/hle/hle.h +++ b/src/audio_core/hle/hle.h @@ -25,6 +25,7 @@ public: ~DspHle(); u16 RecvData(u32 register_number) override; + bool RecvDataIsReady(u32 register_number) const override; std::vector PipeRead(DspPipe pipe_number, u32 length) override; std::size_t GetPipeReadableSize(DspPipe pipe_number) const override; void PipeWrite(DspPipe pipe_number, const std::vector& buffer) override; diff --git a/src/core/hle/service/dsp/dsp_dsp.cpp b/src/core/hle/service/dsp/dsp_dsp.cpp index 8dc31d08d2..6acfad5660 100644 --- a/src/core/hle/service/dsp/dsp_dsp.cpp +++ b/src/core/hle/service/dsp/dsp_dsp.cpp @@ -35,11 +35,9 @@ void DSP_DSP::RecvDataIsReady(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx, 0x02, 1, 0); const u32 register_number = rp.Pop(); - ASSERT_MSG(register_number == 0, "Unknown register_number {}", register_number); - IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); rb.Push(RESULT_SUCCESS); - rb.Push(true); /// 0 = not ready, 1 = ready to read + rb.Push(system.DSP().RecvDataIsReady(register_number)); LOG_DEBUG(Service_DSP, "register_number={}", register_number); }