Added CSND serialization
This commit is contained in:
parent
17b9cbefef
commit
a0c3b91785
3 changed files with 75 additions and 2 deletions
7
TODO
7
TODO
|
@ -15,6 +15,7 @@
|
||||||
☐ Settings
|
☐ Settings
|
||||||
☐ Telemetry session
|
☐ Telemetry session
|
||||||
☐ Replace SERIALIZE_AS_POD with BOOST_IS_BITWISE_SERIALIZABLE
|
☐ Replace SERIALIZE_AS_POD with BOOST_IS_BITWISE_SERIALIZABLE
|
||||||
|
☐ Review constructor/initialization code
|
||||||
✔ HW @done(19-08-13 15:41)
|
✔ HW @done(19-08-13 15:41)
|
||||||
✔ GPU regs @done(19-08-13 15:41)
|
✔ GPU regs @done(19-08-13 15:41)
|
||||||
✔ LCD regs @done(19-08-13 15:41)
|
✔ LCD regs @done(19-08-13 15:41)
|
||||||
|
@ -69,8 +70,10 @@
|
||||||
☐ CAM @started(19-12-26 10:37)
|
☐ CAM @started(19-12-26 10:37)
|
||||||
Need to check capture_result
|
Need to check capture_result
|
||||||
☐ CECD
|
☐ CECD
|
||||||
☐ CGF
|
☐ Archive backend / file handles
|
||||||
☐ CSND
|
☐ CFG
|
||||||
|
Also needs archive backend..
|
||||||
|
✔ CSND @started(19-12-26 17:51) @done(19-12-26 17:56) @lasted(5m30s)
|
||||||
☐ DLP
|
☐ DLP
|
||||||
☐ DSP
|
☐ DSP
|
||||||
☐ ERR
|
☐ ERR
|
||||||
|
|
|
@ -3,11 +3,25 @@
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include "common/alignment.h"
|
#include "common/alignment.h"
|
||||||
|
#include "common/archives.h"
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
#include "core/hle/ipc_helpers.h"
|
#include "core/hle/ipc_helpers.h"
|
||||||
#include "core/hle/result.h"
|
#include "core/hle/result.h"
|
||||||
#include "core/hle/service/csnd/csnd_snd.h"
|
#include "core/hle/service/csnd/csnd_snd.h"
|
||||||
|
|
||||||
|
namespace boost::serialization {
|
||||||
|
template <class Archive>
|
||||||
|
void load_construct_data(Archive& ar, Service::CSND::CSND_SND* t, const unsigned int)
|
||||||
|
{
|
||||||
|
::new(t)Service::CSND::CSND_SND(Core::Global<Core::System>());
|
||||||
|
}
|
||||||
|
|
||||||
|
template
|
||||||
|
void load_construct_data<iarchive>(iarchive& ar, Service::CSND::CSND_SND* t, const unsigned int);
|
||||||
|
}
|
||||||
|
|
||||||
|
SERIALIZE_EXPORT_IMPL(Service::CSND::CSND_SND)
|
||||||
|
|
||||||
namespace Service::CSND {
|
namespace Service::CSND {
|
||||||
|
|
||||||
enum class CommandId : u16 {
|
enum class CommandId : u16 {
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <boost/serialization/array.hpp>
|
||||||
|
#include <boost/serialization/shared_ptr.hpp>
|
||||||
#include "core/hle/kernel/mutex.h"
|
#include "core/hle/kernel/mutex.h"
|
||||||
#include "core/hle/kernel/shared_memory.h"
|
#include "core/hle/kernel/shared_memory.h"
|
||||||
#include "core/hle/service/service.h"
|
#include "core/hle/service/service.h"
|
||||||
|
@ -33,6 +35,15 @@ enum class LoopMode : u8 {
|
||||||
struct AdpcmState {
|
struct AdpcmState {
|
||||||
s16 predictor = 0;
|
s16 predictor = 0;
|
||||||
u8 step_index = 0;
|
u8 step_index = 0;
|
||||||
|
|
||||||
|
private:
|
||||||
|
template <class Archive>
|
||||||
|
void serialize(Archive& ar, const unsigned int)
|
||||||
|
{
|
||||||
|
ar & predictor;
|
||||||
|
ar & step_index;
|
||||||
|
}
|
||||||
|
friend class boost::serialization::access;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Channel {
|
struct Channel {
|
||||||
|
@ -52,6 +63,29 @@ struct Channel {
|
||||||
LoopMode loop_mode = LoopMode::Manual;
|
LoopMode loop_mode = LoopMode::Manual;
|
||||||
Encoding encoding = Encoding::Pcm8;
|
Encoding encoding = Encoding::Pcm8;
|
||||||
u8 psg_duty = 0;
|
u8 psg_duty = 0;
|
||||||
|
|
||||||
|
private:
|
||||||
|
template <class Archive>
|
||||||
|
void serialize(Archive& ar, const unsigned int)
|
||||||
|
{
|
||||||
|
ar & block1_address;
|
||||||
|
ar & block2_address;
|
||||||
|
ar & block1_size;
|
||||||
|
ar & block2_size;
|
||||||
|
ar & block1_adpcm_state;
|
||||||
|
ar & block2_adpcm_state;
|
||||||
|
ar & block2_adpcm_reload;
|
||||||
|
ar & left_channel_volume;
|
||||||
|
ar & right_channel_volume;
|
||||||
|
ar & left_capture_volume;
|
||||||
|
ar & right_capture_volume;
|
||||||
|
ar & sample_rate;
|
||||||
|
ar & linear_interpolation;
|
||||||
|
ar & loop_mode;
|
||||||
|
ar & encoding;
|
||||||
|
ar & psg_duty;
|
||||||
|
}
|
||||||
|
friend class boost::serialization::access;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CSND_SND final : public ServiceFramework<CSND_SND> {
|
class CSND_SND final : public ServiceFramework<CSND_SND> {
|
||||||
|
@ -222,9 +256,31 @@ private:
|
||||||
u32 type1_command_offset = 0;
|
u32 type1_command_offset = 0;
|
||||||
|
|
||||||
u32 acquired_channel_mask = 0;
|
u32 acquired_channel_mask = 0;
|
||||||
|
|
||||||
|
template <class Archive>
|
||||||
|
void serialize(Archive& ar, const unsigned int)
|
||||||
|
{
|
||||||
|
ar & mutex;
|
||||||
|
ar & shared_memory;
|
||||||
|
ar & capture_units;
|
||||||
|
ar & channels;
|
||||||
|
ar & master_state_offset;
|
||||||
|
ar & channel_state_offset;
|
||||||
|
ar & capture_state_offset;
|
||||||
|
ar & type1_command_offset;
|
||||||
|
ar & acquired_channel_mask;
|
||||||
|
}
|
||||||
|
friend class boost::serialization::access;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Initializes the CSND_SND Service
|
/// Initializes the CSND_SND Service
|
||||||
void InstallInterfaces(Core::System& system);
|
void InstallInterfaces(Core::System& system);
|
||||||
|
|
||||||
} // namespace Service::CSND
|
} // namespace Service::CSND
|
||||||
|
|
||||||
|
BOOST_CLASS_EXPORT_KEY(Service::CSND::CSND_SND)
|
||||||
|
|
||||||
|
namespace boost::serialization {
|
||||||
|
template <class Archive>
|
||||||
|
void load_construct_data(Archive& ar, Service::CSND::CSND_SND* t, const unsigned int);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue