audio_core/hle: move implementation of LoadComponent

This commit is contained in:
Weiyi Wang 2018-12-06 08:35:21 -05:00
parent 9ab4e3c686
commit 4add509b20
4 changed files with 22 additions and 13 deletions

View file

@ -88,6 +88,9 @@ public:
/// Sets the dsp class that we trigger interrupts for
virtual void SetServiceToInterrupt(std::weak_ptr<Service::DSP::DSP_DSP> dsp) = 0;
/// Loads the DSP program
virtual void LoadComponent(const std::vector<u8>& buffer) = 0;
/// Select the sink to use based on sink id.
void SetSink(const std::string& sink_id, const std::string& audio_device);
/// Get the current sink

View file

@ -11,6 +11,7 @@
#include "audio_core/sink.h"
#include "common/assert.h"
#include "common/common_types.h"
#include "common/hash.h"
#include "common/logging/log.h"
#include "core/core.h"
#include "core/core_timing.h"
@ -399,4 +400,15 @@ void DspHle::SetServiceToInterrupt(std::weak_ptr<DSP_DSP> dsp) {
impl->SetServiceToInterrupt(std::move(dsp));
}
void DspHle::LoadComponent(const std::vector<u8>& component_data) {
// HLE doesn't need DSP program. Only log some info here
LOG_INFO(Service_DSP, "Firmware hash: {:#018x}",
Common::ComputeHash64(component_data.data(), component_data.size()));
// Some versions of the firmware have the location of DSP structures listed here.
if (component_data.size() > 0x37C) {
LOG_INFO(Service_DSP, "Structures hash: {:#018x}",
Common::ComputeHash64(component_data.data() + 0x340, 60));
}
}
} // namespace AudioCore

View file

@ -35,6 +35,8 @@ public:
void SetServiceToInterrupt(std::weak_ptr<Service::DSP::DSP_DSP> dsp) override;
void LoadComponent(const std::vector<u8>& buffer) override;
private:
struct Impl;
friend struct Impl;

View file

@ -4,7 +4,6 @@
#include "audio_core/audio_types.h"
#include "common/assert.h"
#include "common/hash.h"
#include "common/logging/log.h"
#include "core/core.h"
#include "core/hle/ipc_helpers.h"
@ -173,23 +172,16 @@ void DSP_DSP::LoadComponent(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
rb.Push(RESULT_SUCCESS);
rb.Push(true); /// Pretend that we actually loaded the DSP firmware
rb.Push(true);
rb.PushMappedBuffer(buffer);
// TODO(bunnei): Implement real DSP firmware loading
std::vector<u8> component_data(size);
buffer.Read(component_data.data(), 0, size);
LOG_INFO(Service_DSP, "Firmware hash: {:#018x}",
Common::ComputeHash64(component_data.data(), component_data.size()));
// Some versions of the firmware have the location of DSP structures listed here.
if (size > 0x37C) {
LOG_INFO(Service_DSP, "Structures hash: {:#018x}",
Common::ComputeHash64(component_data.data() + 0x340, 60));
}
LOG_WARNING(Service_DSP, "(STUBBED) called size=0x{:X}, prog_mask=0x{:08X}, data_mask=0x{:08X}",
size, prog_mask, data_mask);
system.DSP().LoadComponent(component_data);
LOG_INFO(Service_DSP, "(STUBBED) called size=0x{:X}, prog_mask=0x{:08X}, data_mask=0x{:08X}",
size, prog_mask, data_mask);
}
void DSP_DSP::FlushDataCache(Kernel::HLERequestContext& ctx) {