mirror of
https://github.com/Lime3DS/Lime3DS
synced 2024-12-28 18:12:44 -06:00
audio_core/hle: move implementation of LoadComponent
This commit is contained in:
parent
9ab4e3c686
commit
4add509b20
4 changed files with 22 additions and 13 deletions
|
@ -88,6 +88,9 @@ public:
|
||||||
/// Sets the dsp class that we trigger interrupts for
|
/// Sets the dsp class that we trigger interrupts for
|
||||||
virtual void SetServiceToInterrupt(std::weak_ptr<Service::DSP::DSP_DSP> dsp) = 0;
|
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.
|
/// Select the sink to use based on sink id.
|
||||||
void SetSink(const std::string& sink_id, const std::string& audio_device);
|
void SetSink(const std::string& sink_id, const std::string& audio_device);
|
||||||
/// Get the current sink
|
/// Get the current sink
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include "audio_core/sink.h"
|
#include "audio_core/sink.h"
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
|
#include "common/hash.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
#include "core/core_timing.h"
|
#include "core/core_timing.h"
|
||||||
|
@ -399,4 +400,15 @@ void DspHle::SetServiceToInterrupt(std::weak_ptr<DSP_DSP> dsp) {
|
||||||
impl->SetServiceToInterrupt(std::move(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
|
} // namespace AudioCore
|
||||||
|
|
|
@ -35,6 +35,8 @@ public:
|
||||||
|
|
||||||
void SetServiceToInterrupt(std::weak_ptr<Service::DSP::DSP_DSP> dsp) override;
|
void SetServiceToInterrupt(std::weak_ptr<Service::DSP::DSP_DSP> dsp) override;
|
||||||
|
|
||||||
|
void LoadComponent(const std::vector<u8>& buffer) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct Impl;
|
struct Impl;
|
||||||
friend struct Impl;
|
friend struct Impl;
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
#include "audio_core/audio_types.h"
|
#include "audio_core/audio_types.h"
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "common/hash.h"
|
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
#include "core/hle/ipc_helpers.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);
|
IPC::RequestBuilder rb = rp.MakeBuilder(2, 2);
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.Push(true); /// Pretend that we actually loaded the DSP firmware
|
rb.Push(true);
|
||||||
rb.PushMappedBuffer(buffer);
|
rb.PushMappedBuffer(buffer);
|
||||||
|
|
||||||
// TODO(bunnei): Implement real DSP firmware loading
|
|
||||||
|
|
||||||
std::vector<u8> component_data(size);
|
std::vector<u8> component_data(size);
|
||||||
buffer.Read(component_data.data(), 0, size);
|
buffer.Read(component_data.data(), 0, size);
|
||||||
|
|
||||||
LOG_INFO(Service_DSP, "Firmware hash: {:#018x}",
|
system.DSP().LoadComponent(component_data);
|
||||||
Common::ComputeHash64(component_data.data(), component_data.size()));
|
|
||||||
// Some versions of the firmware have the location of DSP structures listed here.
|
LOG_INFO(Service_DSP, "(STUBBED) called size=0x{:X}, prog_mask=0x{:08X}, data_mask=0x{:08X}",
|
||||||
if (size > 0x37C) {
|
size, prog_mask, data_mask);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DSP_DSP::FlushDataCache(Kernel::HLERequestContext& ctx) {
|
void DSP_DSP::FlushDataCache(Kernel::HLERequestContext& ctx) {
|
||||||
|
|
Loading…
Reference in a new issue